1
0
mirror of https://github.com/php/web-php.git synced 2026-03-23 23:02:13 +01:00

Add a "headsup" bar when we add new news entries

This commit is contained in:
Hannes Magnusson
2013-12-26 15:16:51 -08:00
parent c1ac5f0722
commit 1c311cc448
5 changed files with 43 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-news.inc';
mirror_setcookie("LAST_NEWS", $_SERVER["REQUEST_TIME"], 60*60*24*365);
site_header("PHP Conferences around the world", array(
'headtags' => '<link rel="alternate" type="application/atom+xml" title="PHP: Conference announcements" href="' . $MYSITE . 'feed.atom" />',
'current' => 'community',

View File

@@ -94,6 +94,9 @@ if ($config["cache"]) {
</div>
<div id="flash-message"></div>
</nav>
<?php if (!empty($config["headsup"])): ?>
<div class="headsup"><?php echo $config["headsup"]?></div>
<?php endif ?>
<nav id="trick"><div><?php doc_toc("en") ?></div></nav>
<?php if (!empty($config['breadcrumbs'])): ?>

View File

@@ -521,10 +521,14 @@ function site_header($title = '', $config = array())
'classes' => '',
'layout_span' => 9,
"cache" => false,
"headsup" => "",
);
$config = array_merge($defaults, $config);
$config["headsup"] = get_news_changes();
$lang = language_convert($config["lang"]);
$curr = $config["current"];
$classes = $config['classes'];
@@ -546,6 +550,25 @@ function site_footer($config = array())
require dirname(__FILE__) . "/footer.inc";
}
function get_news_changes()
{
include dirname(__FILE__) . "/pregen-news.inc";
$date = date_create($NEWS_ENTRIES[0]["updated"]);
if (isset($_COOKIE["LAST_NEWS"]) && $_COOKIE["LAST_NEWS"] >= $date->getTimestamp()) {
return false;
}
if ($_SERVER["BASE_PAGE"] == "index.php") {
return false;
}
$date->modify("+1 week");
if ($date->getTimestamp() > $_SERVER["REQUEST_TIME"]) {
$link = substr($NEWS_ENTRIES[0]["link"][0]["href"], 14); // Strip http://php.net
$title = $NEWS_ENTRIES[0]["title"];
return "<a href='{$link}'>{$title}</a>";
}
}
function news_toc($sections = null) {
include dirname(__FILE__) . "/pregen-news.inc";
$items = array(

View File

@@ -39,6 +39,8 @@ include_once 'include/pregen-confs.inc';
include_once 'include/pregen-news.inc';
include_once 'include/version.inc';
mirror_setcookie("LAST_NEWS", $_SERVER["REQUEST_TIME"], 60*60*24*365);
$content = "<div class='home-content'>";
$releasenews = 0;

View File

@@ -475,5 +475,19 @@ div.elephpants img:focus {
position: relative;
}
.headsup {
padding:.25em 0;
height:1.5em;
border-bottom:.125em solid #696;
background-color: #9c9;
color:#fff;
}
.headsup,
.headsup a {
margin: 0 auto;
text-align: center;
color: #fff;
}
// vim: set ts=2 sw=2 et: