cvs: phpweb /include layout.inc
| From: | Hannes Magnusson | Date: | Thu, 07 Jun 2007 10:36:00 +0000 |
| Subject: | cvs: phpweb /include layout.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-35628@lists.php.net to get a copy of this message | ||
bjori Thu Jun 7 10:36:00 2007 UTC
Modified files:
/phpweb/include layout.inc
Log:
Add a function to print out news entries (used by /, /conferences/ and /archive/)
Remove hardcoded year
Show the current-year-archive too
http://cvs.php.net/viewvc.cgi/phpweb/include/layout.inc?r1=1.267&r2=1.268&diff_format=u
Index: phpweb/include/layout.inc
diff -u phpweb/include/layout.inc:1.267 phpweb/include/layout.inc:1.268
--- phpweb/include/layout.inc:1.267 Tue May 8 04:35:59 2007
+++ phpweb/include/layout.inc Thu Jun 7 10:36:00 2007
@@ -1,5 +1,5 @@
<?php
-/* $Id: layout.inc,v 1.267 2007/05/08 04:35:59 rasmus Exp $ */
+/* $Id: layout.inc,v 1.268 2007/06/07 10:36:00 bjori Exp $ */
// Set the static content root differently on php.net
$_SERVER['STATIC_ROOT'] = ($MYSITE == 'http://www.php.net/') ?
@@ -600,7 +600,7 @@
<ul class="toc">
';
- for ($i = 1998; $i < 2007; $i++) {
+ for ($i = 1998; $i <= date("Y"); $i++) {
$pagename = "archive/$i.php";
$classname = ($pagename == $_SERVER['BASE_PAGE'] ? '
class="active"' : '');
$SIDEBAR_DATA .= "<li{$classname}><a
href=\"/{$pagename}\">{$i}</a></li>\n";
@@ -608,4 +608,23 @@
$SIDEBAR_DATA .= '</ul>';
}
+// Print news
+function print_news($news) {
+ foreach($news as $item) {
+ $image = "";
+ if($item["image"]) {
+ $image = news_image($item["image"]["link"],
$item["image"]["image"], $item["image"]["title"]);
+ }
+ echo <<< EOT
+<div class="newsItem">
+ $image
+ <a name="{$item["fragment"]}"
id="{$item["fragment"]}"><h1>{$item["title"]}</h1></a>
+ {$item["content"]}
+</div>
+
+<hr />
+
+EOT;
+ }
+}
/* vim: set et ts=4 sw=4 ft=php: : */