diff --git a/iframe-sega.php b/iframe-sega.php new file mode 100644 index 0000000..6ebf826 --- /dev/null +++ b/iframe-sega.php @@ -0,0 +1,43 @@ +<?php + header('Content-Type: text/html; charset=utf-8'); + + if (!ini_get('date.timezone')) { + date_default_timezone_set('Europe/Paris'); + } + + ini_set('display_errors', 1); + ini_set('display_startup_errors', 1); + error_reporting(E_ALL); + + + require_once 'feed.php'; + + $rssSonic = Feed::loadRss('https://shaarli.kazhnuz.space/feed/rss?&searchtags=Sonic'); + $rssSEGA = Feed::loadRss('https://shaarli.kazhnuz.space/feed/rss?&searchtags=SEGA'); +?> + +<!DOCTYPE html> +<html lang="fr"> + <head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta http-equiv="X-UA-Compatible" content="ie=edge"> + <title>Press Garden Zone</title> + <link rel="stylesheet" href="./iframe.css"> + <link rel="icon" href="./favicon.png"> + </head> + <body> + <main> + <?php $i = 1; ?> + <?php foreach ($rssSEGA->item as $item): ?> + <?php if ($i <= 6) { ?> + <article> + <div><a href="/?show=sega#news-sega-<?php echo $i ?>" target="_blank"><?php echo htmlspecialchars($item->title) ?></a></div> + <div><small><?php echo date('j.n.Y H:i', (int) $item->timestamp) ?></small></div> + </article> + <?php $i++; ?> + <?php } ?> + <?php endforeach ?> + </main> + </body> +</html> diff --git a/iframe-sonic.php b/iframe-sonic.php new file mode 100644 index 0000000..95b93f6 --- /dev/null +++ b/iframe-sonic.php @@ -0,0 +1,43 @@ +<?php + header('Content-Type: text/html; charset=utf-8'); + + if (!ini_get('date.timezone')) { + date_default_timezone_set('Europe/Paris'); + } + + ini_set('display_errors', 1); + ini_set('display_startup_errors', 1); + error_reporting(E_ALL); + + + require_once 'feed.php'; + + $rssSonic = Feed::loadRss('https://shaarli.kazhnuz.space/feed/rss?&searchtags=Sonic'); + $rssSEGA = Feed::loadRss('https://shaarli.kazhnuz.space/feed/rss?&searchtags=SEGA'); +?> + +<!DOCTYPE html> +<html lang="fr"> + <head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta http-equiv="X-UA-Compatible" content="ie=edge"> + <title>Press Garden Zone</title> + <link rel="stylesheet" href="./iframe.css"> + <link rel="icon" href="./favicon.png"> + </head> + <body> + <main> + <?php $i = 1; ?> + <?php foreach ($rssSonic->item as $item): ?> + <?php if ($i <= 6) { ?> + <article> + <div><a href="/#news-sonic-<?php echo $i ?>" target="_blank"><?php echo htmlspecialchars($item->title) ?></a></div> + <div><small><?php echo date('j.n.Y H:i', (int) $item->timestamp) ?></small></div> + </article> + <?php $i++; ?> + <?php } ?> + <?php endforeach ?> + </main> + </body> +</html> diff --git a/iframe.css b/iframe.css new file mode 100644 index 0000000..e4301c3 --- /dev/null +++ b/iframe.css @@ -0,0 +1,29 @@ +body { + font-family: Inter, Cantarell, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; + margin:0; + padding:0; +} + +article { + display: flex; + justify-content: space-between; + padding: 3px; + background-color: rgba(0,0,255,0.08); + border-radius: 4px; +} + +article:not(:first-child) { + margin-top: 3px; +} + +article div:first-child { + text-overflow: ellipsis; + overflow: hidden; + white-space:nowrap; +} + +article div:last-child { + width:120px; + min-width: 120px; + text-align: right; +} \ No newline at end of file diff --git a/index.php b/index.php index 738cfb2..cb5cf28 100644 --- a/index.php +++ b/index.php @@ -14,6 +14,11 @@ $rssSonic = Feed::loadRss('https://shaarli.kazhnuz.space/feed/rss?&searchtags=Sonic'); $rssSEGA = Feed::loadRss('https://shaarli.kazhnuz.space/feed/rss?&searchtags=SEGA'); + + $showSEGA = false; + if ($_GET != null && $_GET["show"] == "sega") { + $showSEGA = true; + } ?> <!DOCTYPE html> @@ -30,33 +35,38 @@ <header> <nav> <ul> - <li><a href="#" class="active" id="link-sonic">Sonic</a></li> - <li><a href="#" id="link-sega">SEGA</a></li> + <li><a href="#" <?php if ($showSEGA == false) { ?> class="active" <?php } ?> id="link-sonic">Sonic</a></li> + <li><a href="#" <?php if ($showSEGA == true ) { ?> class="active" <?php } ?> id="link-sega">SEGA</a></li> </ul> </nav> </header> <main> <h1 id="head">Press Garden Zone</h1> - <section class="shown" id="section-sonic"> + <section <?php if ($showSEGA == false) { ?> class="shown" <?php } ?> id="section-sonic"> <?php $i = 1; ?> <?php foreach ($rssSonic->item as $item): ?> - <?php if ($i <= 8) { ?> - <article> + <?php if ($i <= 12) { ?> + <article id="news-sonic-<?php echo $i; ?>"> <h2><a href="<?php echo htmlspecialchars($item->url) ?>"><?php echo htmlspecialchars($item->title) ?></a> <small><?php echo date('j.n.Y H:i', (int) $item->timestamp) ?></small></h2> <div><?php echo $item->description ?></div> </article> + <?php $i++; ?> <?php } ?> <?php endforeach ?> <div class="btn-area"><a class="btn" href="https://shaarli.kazhnuz.space/?searchtags=Sonic"> Plus ancien articles </a></div> </section> - <section id="section-sega"> + <section <?php if ($showSEGA == true ) { ?> class="shown" <?php } ?> id="section-sega"> + <?php $i = 1; ?> <?php foreach ($rssSEGA->item as $item): ?> - <article> + <?php if ($i <= 12) { ?> + <article id="news-sega-<?php echo $i; ?>"> <h2><a href="<?php echo htmlspecialchars($item->url) ?>"><?php echo htmlspecialchars($item->title) ?></a> <small><?php echo date('j.n.Y H:i', (int) $item->timestamp) ?></small></h2> <div><?php echo $item->description ?></div> </article> + <?php $i++; ?> + <?php } ?> <?php endforeach ?> <div class="btn-area"><a class="btn" href="https://shaarli.kazhnuz.space/?searchtags=SEGA"> Plus ancien articles </a></div> </section>