xref: /web-php/conferences/index.php (revision 59c070f5)
1<?php
2
3$_SERVER['BASE_PAGE'] = 'conferences/index.php';
4include_once __DIR__ . '/../include/prepend.inc';
5include_once __DIR__ . '/../include/pregen-news.inc';
6
7mirror_setcookie("LAST_NEWS", $_SERVER["REQUEST_TIME"], 60 * 60 * 24 * 365);
8site_header("PHP Conferences around the world", [
9    'headtags' => '<link rel="alternate" type="application/atom+xml" title="PHP: Conference announcements" href="' . $MYSITE . 'feed.atom">',
10    'current' => 'community',
11    'css' => ['home.css'],
12]);
13
14$content = "<div class='home-content'>";
15$frontpage = [];
16foreach ($NEWS_ENTRIES as $entry) {
17    foreach ($entry["category"] as $category) {
18        if ($category["term"] == "cfp") {
19            $frontpage[] = $entry;
20            break;
21        }
22        if ($category["term"] == "conferences") {
23            $frontpage[] = $entry;
24            break;
25        }
26    }
27}
28$panels = '<p class="prepend"><a href="https://wiki.php.net/conferences">Want to see your conference appear here?</a></p>';
29
30foreach ($frontpage as $entry) {
31    $link = preg_replace('~^(http://php.net/|https://www.php.net/)~', '', $entry["id"]);
32    $id = parse_url($entry["id"], PHP_URL_FRAGMENT);
33    $date = date_format(date_create($entry["updated"]), 'Y-m-d');
34    $content .= '<div class="newsentry">';
35    $content .= '<h3 class="newstitle title"><a href="' . $MYSITE . $link . '" id="' . $id . '">' . $entry["title"] . '</a></h3>';
36    $content .= '<div class="newsimage">';
37
38    if (isset($entry["newsImage"])) {
39        $content .= sprintf('<a href="%s"><img src="/images/news/%s"></a>', $entry["newsImage"]["link"], $entry["newsImage"]["content"]);
40    }
41
42    $content .= '</div>';
43    $content .= '<div class="newscontent">';
44    $content .= $entry["content"];
45    $content .= '</div>';
46    $content .= '</div>';
47
48    $panels .= sprintf('<p class="panel"><a href="%s">%s</a></p>', $entry["newsImage"]["link"], $entry["title"]);
49}
50$content .= "</div>";
51
52echo $content;
53
54site_footer([
55    "atom" => "/feed.atom",
56    "elephpants" => true,
57    "sidebar" => $panels,
58]);
59