atom feed1 message in net.php.lists.php-webmastersvn: /web/php/trunk/include/ layout.i...
FromSent OnAttachments
Hannes MagnussonDec 26, 2010 8:12 am 
Subject:svn: /web/php/trunk/include/ layout.inc shared-manual.inc
From:Hannes Magnusson (bjo@php.net)
Date:Dec 26, 2010 8:12:18 am
List:net.php.lists.php-webmaster

bjori Sun, 26 Dec 2010 16:12:18 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=306688

Log: DEPLOY THE NEW DESIGN .in beta mode :) (use php.net/my.php to enable it)

Changed paths: U web/php/trunk/include/layout.inc U web/php/trunk/include/shared-manual.inc

Modified: web/php/trunk/include/layout.inc =================================================================== --- web/php/trunk/include/layout.inc 2010-12-26 16:11:06 UTC (rev 306687) +++ web/php/trunk/include/layout.inc 2010-12-26 16:12:18 UTC (rev 306688) @@ -63,6 +63,9 @@

function site_header($title = '', $config = array()) { + if (myphpnet_beta()) { + return site_header_beta($title, $config); + } global $EXPL_LANG, $SIDEBAR_DATA, $RSIDEBAR_DATA, $PAGE_COLUMNS, $PGI;

// Default to empty array if improper parameter passed @@ -295,6 +298,9 @@

function site_footer($config = array()) { + if (myphpnet_beta()) { + return site_footer_beta($config); + } global $LAST_UPDATED, $PAGE_COLUMNS;

$stats = (have_stats() ? "\n <a href=\"/stats/\">stats</a> |" :
""); @@ -762,5 +768,102 @@ EOT; } } + + + + +// BETA +function site_header_beta($title = '', $config = array()) +{ + global $SIDEBAR_DATA; + $lang = myphpnet_language(); + + if (isset($config["current"])) { + $curr = $config["current"]; + } + else { + switch($_SERVER["BASE_PAGE"]) { + case "privacy.php": + default: + $curr = ""; + break; + + case "mailing-lists.php": + case "sidebars.php": + case "sites.php": + case "support.php": + case "tips.php": + case "urlhowto.php": + $curr = "help"; + break; + } + } + if (empty($title)) { + $title = "Hypertext Preprocessor"; + } + + require __DIR__ ."/header.inc"; +} +function site_footer_beta($config = array()) +{ + require __DIR__ . "/footer.inc"; +} + +function doc_toc($lang) { + $file = __DIR__ . "/../manual/$lang/toc/index.inc"; + if (!file_exists($file)) { + $lang = "en"; // Fallback on english if the translation doesn't exist + $file = __DIR__ . "/../manual/en/toc/index.inc"; + } + require __DIR__ . "/../manual/$lang/toc/index.inc"; + + echo "<dl>\n"; + doc_toc_list($lang, $TOC, "getting-started"); + doc_toc_list($lang, $TOC, "langref"); + echo "</dl>\n"; + + echo "<dl>\n"; + doc_toc_list($lang, $TOC, "security"); + doc_toc_list($lang, $TOC, "features"); + echo "</dl>\n"; + + echo "<dl>\n"; + doc_toc_list($lang, $TOC, "funcref"); + echo "</dl>\n"; + + echo "<dl>\n"; + doc_toc_title($lang, $TOC, "install"); + doc_toc_title($lang, $TOC, "internals2"); + doc_toc_title($lang, $TOC, "faq"); + doc_toc_title($lang, $TOC, "appendices"); + echo "<dt><a href='/quickref.php'>Quick function reference</a></dt>\n"; + echo "</dl>\n"; + +} +function doc_toc_list($lang, $index, $file) { + include __DIR__ . "/../manual/$lang/toc/$file.inc"; + + doc_toc_title($lang, $index, $file); + foreach($TOC as $entry) { + echo "\t<dd><a
href='/manual/$lang/{$entry[0]}'>{$entry[1]}</a></dd>\n"; + } + echo "</dt>\n"; +} +function doc_toc_title($lang, $index, $file) { + foreach($index as $entry) { + if ($entry[0] == "$file.php") { + $link = $entry[0]; + $title = $entry[1]; + break; + } + } + echo "<dt><a href='/manual/$lang/$link'>$title</a></dt>\n"; +} + + + + + + /* vim: set et ts=4 sw=4 ft=php: : */

Modified: web/php/trunk/include/shared-manual.inc =================================================================== --- web/php/trunk/include/shared-manual.inc 2010-12-26 16:11:06 UTC (rev 306687) +++ web/php/trunk/include/shared-manual.inc 2010-12-26 16:12:18 UTC (rev 306688) @@ -24,6 +24,9 @@ // including HTTP header information function manual_setup($page_data) { + if (myphpnet_beta()) { + return manual_setup_beta($page_data); + } global $PGI; $PGI = array_merge($PGI, $page_data); // merge for BC reasons

@@ -44,6 +47,9 @@ // TODO: replace logo with logos/php-med-trans-light.gif on print function manual_header() { + if (myphpnet_beta()) { + return manual_header_beta(); + } global $PGI, $LAST_UPDATED, $MYSITE;

// Get values out of the config array @@ -154,6 +160,9 @@ // Print out manual page footer function manual_footer() { + if (myphpnet_beta()) { + return manual_header_beta(); + } global $PGI;

// Get vars for easy handling @@ -433,3 +442,41 @@

/* vim: set et ts=4 sw=4: */

+function manual_setup_beta($setup) { + $siblings = array(); + foreach($setup["toc"] as $entry) { + $siblings[] = array( + "title" => $entry[1], + "link" => $entry[0], + "current" => $setup["this"][0] == $entry[0], + ); + } + $menu = array(); + foreach(array_reverse($setup["parents"]) as $parent) { + $menu[] = array( + "title" => $parent[1], + "link" => $parent[0], + "children" => array(), + ); + } + // The index manual page has no parent.. + if ($setup["up"][0]) { + $menu[] = array( + "title" => $setup["up"][1], + "link" => $setup["up"][0], + "children" => $siblings, + ); + } + + $_SERVER["BASE_PAGE"] = "/manual/" . $setup["head"][1] . "/" .
$setup["this"][0]; + site_header($setup["this"][1] . " - Manual ", array("current" => "docs",
"leftmenu" => $menu)); + + echo '<div class="layout-content">'; +} + +function manual_header_beta(){} +function manual_footer_beta() { + echo '</div>'; // layout-content + site_footer(); +} +