svn: /web/php/trunk/include/ header.inc layout.inc
| From: | Hannes Magnusson | Date: | Sun, 26 Dec 2010 19:53:10 +0000 |
| Subject: | svn: /web/php/trunk/include/ header.inc layout.inc | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-9841@lists.php.net to get a copy of this message | ||
bjori Sun, 26 Dec 2010 19:53:10 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=306699
Log:
Generate the news list in the main toc
Changed paths:
U web/php/trunk/include/header.inc
U web/php/trunk/include/layout.inc
Modified: web/php/trunk/include/header.inc
===================================================================
--- web/php/trunk/include/header.inc 2010-12-26 19:31:54 UTC (rev 306698)
+++ web/php/trunk/include/header.inc 2010-12-26 19:53:10 UTC (rev 306699)
@@ -51,22 +51,14 @@
<li class="parent <?php echo $curr == "docs" ? "current" :
""?>">
<a href="/docs.php" class="menu-link">Documentation</a>
<div class="children"><div class="children-1"><div
class="children-2">
- <?php echo doc_toc($lang); ?>
+ <?php doc_toc($lang); ?>
<br style="clear: both;" />
</div></div></div>
</li>
<li class="parent <?php echo $curr == "community" ? "current" :
""?>">
<a href="/community.php" class="menu-link">Community</a>
<div class="children"><div class="children-1"><div
class="children-2">
- <dl style="width: 300px;">
- <dt><a href="/conferences/">Conferences</a></dt>
- <dd><a href="/conferences/">All upcoming PHP
conferences</a></dd>
- <dd><a href="/submit-event.php">Add a new
conference</a></dd>
- <dt><a href="#">News</a></dt>
- <dd><a href="#">Recent headline 1 (Oct 6)</a></dd>
- <dd><a href="#">Another recent headline 1 (Oct
4)</a></dd>
- <dd><a href="#">Yet another headline with a lot of text (Oct
2)</a></dd>
- </dl>
+ <?php news_toc() ?>
<dl>
<dt><a href="http://wiki.php.net/">PHP Wiki</a></dt>
<dd><a href="http://wiki.php.net/rfc">Write a
RFC</a></dd>
Modified: web/php/trunk/include/layout.inc
===================================================================
--- web/php/trunk/include/layout.inc 2010-12-26 19:31:54 UTC (rev 306698)
+++ web/php/trunk/include/layout.inc 2010-12-26 19:53:10 UTC (rev 306699)
@@ -699,7 +699,8 @@
}
// Print news
-function print_news($news, $dog, $max = 5, $onlyyear = null) {
+function print_news($news, $dog, $max = 5, $onlyyear = null, $return = false) {
+ $retval = array();
$count = 0;
$news = $news ? $news : array(); // default to empty array (if no news)
foreach($news as $item) {
@@ -753,6 +754,15 @@
continue;
}
+ if ($return) {
+ $retval[] = array(
+ "title" => $item["title"],
+ "id" => $id,
+ "permlink" => $permlink,
+ );
+ continue;
+ }
+
echo <<< EOT
<div class="newsItem hentry{$vevent}">
<div class="newsImage">{$image}</div>
@@ -767,6 +777,8 @@
EOT;
}
+
+ return $retval;
}
@@ -815,6 +827,36 @@
require dirname(__FILE__) . "/footer.inc";
}
+function news_toc() {
+ include dirname(__FILE__) . "/pregen-news.inc";
+ $items = array(
+ array(
+ "title" => "News",
+ "link" => "/",
+ "children" => print_news($NEWS_ENTRIES, "frontpage", 3, null,
true),
+ ),
+ array(
+ "title" => "Conferences",
+ "link" => "/conferences/",
+ "children" => print_news($NEWS_ENTRIES, "conferences", 3, null,
true),
+ ),
+ array(
+ "title" => "Call for Papers",
+ "link" => "/conferences/",
+ "children" => print_news($NEWS_ENTRIES, "cfp", 3, null, true),
+ ),
+ );
+
+ echo "<dl>\n";
+ foreach($items as $menu) {
+ echo "<dt><a
href='{$menu["link"]}'>{$menu["title"]}</a></dt>\n";
+ foreach($menu["children"] as $child) {
+ echo "<dd><a
href='{$child["permlink"]}'>{$child["title"]}</a></dd>\n";
+ }
+ }
+ echo "<dt><a href='/archive/'>News
archive</a></dt>\n";
+ echo "</dl>\n";
+}
function doc_toc($lang) {
$file = dirname(__FILE__) . "/../manual/$lang/toc/index.inc";
if (!file_exists($file)) {