cvs: phpweb(NEW_LOOK_2008) / docs.php index.php links.php my.php sites.php support.php /conferences index.php /include layout.inc shared-manual.inc
| From: | Hannes Magnusson | Date: | Tue, 19 Aug 2008 22:03:03 +0000 |
| Subject: | cvs: phpweb(NEW_LOOK_2008) / docs.php index.php links.php my.php sites.php support.php /conferences index.php /include layout.inc shared-manual.inc | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-2464@lists.php.net to get a copy of this message | ||
bjori Tue Aug 19 22:03:03 2008 UTC
Modified files: (Branch: NEW_LOOK_2008)
/phpweb docs.php index.php links.php my.php sites.php support.php
/phpweb/conferences index.php
/phpweb/include layout.inc shared-manual.inc
Log:
- Replaced few include_one()s with include()s
- Added layout helper functions
- Removed some global magic
- Updated few more pages to use the new style
http://cvs.php.net/viewvc.cgi/phpweb/docs.php?r1=1.145&r2=1.145.2.1&diff_format=u Index: phpweb/docs.php diff -u phpweb/docs.php:1.145 phpweb/docs.php:1.145.2.1 --- phpweb/docs.php:1.145 Fri Apr 11 15:26:21 2008 +++ phpweb/docs.php Tue Aug 19 22:03:01 2008 @@ -1,13 +1,17 @@ <?php -// $Id: docs.php,v 1.145 2008/04/11 15:26:21 bjori Exp $ +// $Id: docs.php,v 1.145.2.1 2008/08/19 22:03:01 bjori Exp $ $_SERVER['BASE_PAGE'] = 'docs.php'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; -$SIDEBAR_DATA=' + +site_header("Documentation"); + +column_box(COLUMN_LEFT); +?> <h3>FAQ</h3> <p> The <a href="/FAQ.php">PHP FAQ</a> is your first stop for general - information and those questions that seem to be on most people\'s minds. + information and those questions that seem to be on most people's minds. If you have licensing questions, see the separate <a href="/license/">License FAQ</a>. </p> @@ -37,10 +41,11 @@ great places to find many example scripts and useful functions, organized for your searching pleasure! </p> -'; -site_header("Documentation"); +<?php +column_box(); +column_box(COLUMN_MAIN); ?> <h1>Documentation</h1> @@ -122,4 +127,8 @@ </li> </ul> -<?php site_footer(); +<?php +column_box(); + +site_footer(); + http://cvs.php.net/viewvc.cgi/phpweb/index.php?r1=1.909.2.1&r2=1.909.2.2&diff_format=u Index: phpweb/index.php diff -u phpweb/index.php:1.909.2.1 phpweb/index.php:1.909.2.2 --- phpweb/index.php:1.909.2.1 Sun Aug 17 16:01:50 2008 +++ phpweb/index.php Tue Aug 19 22:03:01 2008 @@ -1,10 +1,8 @@ -<?php // vim: et +<?php // vim: et fdm=marker /* - If you're reading this, it isn't because you've found a security hole. - this is an open source website. read and learn! -*/ - -/* ------------------------------------------------------------------------- */ + * No. You did not find a security hole. + * This is an open source website. + */ // Modified headers {{{ // Get the modification date of this PHP file @@ -45,18 +43,63 @@ // }}} $_SERVER['BASE_PAGE'] = 'index.php'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-events.inc'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-confs.inc'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-news.inc'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/version.inc'; - -// This goes to the left sidebar of the front page {{{ -$SIDEBAR_DATA = ' -<div class="content"> - <div class="block"> - <span class="corners-top"><span></span></span> - <div class="info"> +include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-events.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-confs.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-news.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/version.inc'; + +// Generate conference teaser {{{ +if (is_array($CONF_TEASER) && count($CONF_TEASER)) { + $categories = array("conference" => "Upcoming conferences", "cfp" => "Calling for papers"); + $teaser = ' <li id="news-line"><span class="corners-top"><span></span></span><ul>' . "\n"; + foreach($CONF_TEASER as $k => $a) { + if (is_array($a) && count($a)) { + $teaser .= " <li><span>" . $categories[$k] . "</span>\n"; + $teaser .= " <ul>"; + $count = 0; + $a = preg_replace("'([A-Za-z0-9])([\s\:\-\,]*?)call for(.*?)$'i", "$1", $a); + foreach($a as $url => $title) { + if ($count++ >= 4) { + break; + } + $teaser .= ' <li class="first last"><a href="' . $url. '">' . $title. '</a></li>' . "\n"; + } + $teaser .= " </ul>\n </li>\n"; + } // if set + } + $teaser .= ' </ul><span class="corners-bottom"><span></span></span></li><!-- #news-line -->'."\n"; + $PRE_DATA = $teaser; +} // }}} + +// Write out common header {{{ +site_header("Hypertext Preprocessor", + array( + 'onload' => 'boldEvents();', + 'headtags' => '<link rel="alternate" type="application/atom+xml" title="PHP: Hypertext Preprocessor" href="' . $MYSITE . 'feed.atom" />', + 'link' => array( + array( + "rel" => "search", + "type" => "application/opensearchdescription+xml", + "href" => $MYSITE . "phpnetimprovedsearch.src", + "title" => "Add PHP.net search" + ), + array( + "rel" => "alternate", + "type" => "application/atom+xml", + "href" => $MYSITE . "releases.atom", + "title" => "PHP Release feed" + ), + + ), + ) +); +// }}} + +// {{{ Left sidebar ("What is PHP" & "Thanks to") + +column_box(COLUMN_LEFT); +?> <h3>What is PHP?</h3> <p> @@ -69,11 +112,7 @@ and the example archive sites and some of the other resources available in the <a href="/links.php">links section</a>. </p> -</div> -</div><!-- .block--> - - <div class="block"> - <div class="info"> +<?php echo $END_BLOCK_INFO, $START_BLOCK_INFO; ?> <h3><a href="/thanks.php">Thanks To</a></h3> <ul class="simple"> @@ -96,13 +135,25 @@ <p> You can grab our news as an <a href="/feed.atom">Atom feed</a>. </p> - </div><!--.block--> - <span class="corners-bottom"><span></span></span> - </div> - </div> -'; + +<?php +column_box(); + // }}} +// {{{ News (include/pregen-news.inc) +column(COLUMN_MIDDLE); + +// $NEWS_ENTRIES is generated on master (scripts/pregen_news) from archive/*.xml +print_news($NEWS_ENTRIES, "frontpage"); +echo '<p class="t-center"><a href="/archive/index.php"><strong>News Archive</strong></a></p>'; + +column(); +// }}} + +// Right column (releases/events..) {{{ +column_box(COLUMN_RIGHT, true, array("classes" => array("block" => array("releases")))); + $MIRROR_IMAGE = ''; // Try to find a sponsor image in case this is an official mirror {{{ @@ -154,129 +205,59 @@ list($PHP_5_RC, ) = each($RELEASES[5]); } +?> -$release_box = <<< RELEASE_DATA - <div class="content"> - <div class="block releases"><span class="corners-top"><span></span></span> - <div class="info"> <h3>Stable releases</h3> - <p class="first">Current PHP 5 Stable: <a href="/ChangeLog-5.php#$PHP_5_STABLE"><strong>$PHP_5_STABLE</strong></a></p> + <p class="first">Current PHP 5 Stable: <a href="/ChangeLog-5.php#<?php echo $PHP_5_STABLE ?>"><strong><?php echo $PHP_5_STABLE ?></strong></a></p> <p class="download-button"><a href="/downloads.php#v5"><span>Download</span></a></p> <p class="top-border">Historical PHP Stable: <a href="/downloads.php#v4"><strong>4.4.9</strong></a></p> -RELEASE_DATA; - -if ($PHP_5_RC) { - $release_box .= <<< RELEASE_DATA +<?php +if ($PHP_5_RC): +?> <h4>Release Candidates</h4> - <p class="top-border"><a href="http://qa.php.net/">$PHP_5_RC</a></p> -RELEASE_DATA; -} -$release_box .= <<< RELEASE_DATA + <p class="top-border"><a href="http://qa.php.net/"><?php echo $PHP_5_RC ?></a></p> +<?php +endif; +?> <p><a href="/downloads.php"><strong>Download area »</strong></a></p> - </div><!-- .info --> - </div><!--.block--> -RELEASE_DATA; + <?php echo $END_BLOCK_INFO ?> +<?php /* }}} */ // Generate the event box {{{ -$upcoming_events = <<< UPCOMING_EVENTS - <div class="block"> - <div class="info"> +?> + <?php echo $START_BLOCK_INFO ?> <h3 class="upcoming-events">Upcoming Events</h3> - <div class="calendar"><span class="corners-top"><span></span></span> + <div class="calendar"> + <span class="corners-top"><span></span></span> <h4>Events Calendar</h4> <form method="get" action="/cal.php"> <p> <select class="month" name="cm"> -UPCOMING_EVENTS; - +<?php $months = array(1 => "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); $current = date("m", $_SERVER["REQUEST_TIME"]); foreach($months as $n => $month) { - $upcoming_events .= "<option value='$n' ". ($n == $current ? 'selected="selected"' : '') .">$month</option>\n"; + echo "<option value='$n' ". ($n == $current ? 'selected="selected"' : '') .">$month</option>\n"; } - -$upcoming_events .= <<< UPCOMING_EVENTS +?> </select> <span><input type="submit" class="button" value="View" /></span> </p> </form> - <span class="corners-bottom"><span></span></span></div> - <p class="add-event"><a href="/submit-event.php"><strong>Add event »</strong></a></p> - <div class="events"> - $EVENTS_DATA - </div> + <span class="corners-bottom"><span></span></span> </div><!-- .calendar --> - </div><!-- .info --> - </div><!-- .block --> -UPCOMING_EVENTS; + <p class="add-event"><a href="/submit-event.php"><strong>Add event »</strong></a></p> + <div class="events"> + <?php echo $EVENTS_DATA ?> + </div> +<?php // }}} -// Prepend mirror image & latest releases to sidebar text -$RSIDEBAR_DATA = $MIRROR_IMAGE . $release_box . $upcoming_events; - -// Generate conference teaser {{{ -if (is_array($CONF_TEASER) && count($CONF_TEASER)) { - $categories = array("conference" => "Upcoming conferences", "cfp" => "Calling for papers"); - $teaser = ' <li id="news-line"><span class="corners-top"><span></span></span><ul>' . "\n"; - foreach($CONF_TEASER as $k => $a) { - if (is_array($a) && count($a)) { - $teaser .= " <li><span>" . $categories[$k] . "</span>\n"; - $teaser .= " <ul>"; - $count = 0; - $a = preg_replace("'([A-Za-z0-9])([\s\:\-\,]*?)call for(.*?)$'i", "$1", $a); - foreach($a as $url => $title) { - if ($count++ >= 4) { - break; - } - $teaser .= ' <li class="first last"><a href="' . $url. '">' . $title. '</a></li>' . "\n"; - } - $teaser .= " </ul>\n </li>\n"; - } // if set - } - $teaser .= ' </ul><span class="corners-bottom"><span></span></span></li><!-- #news-line -->'."\n"; - $PRE_DATA = $teaser; -} // }}} - -// Write out common header {{{ -site_header("Hypertext Preprocessor", - array( - 'onload' => 'boldEvents();', - 'headtags' => '<link rel="alternate" type="application/atom+xml" title="PHP: Hypertext Preprocessor" href="' . $MYSITE . 'feed.atom" />', - 'link' => array( - array( - "rel" => "search", - "type" => "application/opensearchdescription+xml", - "href" => $MYSITE . "phpnetimprovedsearch.src", - "title" => "Add PHP.net search" - ), - array( - "rel" => "alternate", - "type" => "application/atom+xml", - "href" => $MYSITE . "releases.atom", - "title" => "PHP Release feed" - ), - - ), - ) -); +column_box(); // }}} -?> - <li id="mid-column"> - <div class="content"> -<?php -/* Where the h*ll did all the news go? - * See ./bin/createNewsEntry - */ -print_news($NEWS_ENTRIES, "frontpage"); -?> - <p class="t-center"><a href="/archive/index.php"><strong>News Archive</strong></a></p> - </div> - </li><!-- #mid-column--> - -<?php site_footer( array("atom" => "/feed.atom") // Add a link to the feed at the bottom ); http://cvs.php.net/viewvc.cgi/phpweb/links.php?r1=1.211&r2=1.211.2.1&diff_format=u Index: phpweb/links.php diff -u phpweb/links.php:1.211 phpweb/links.php:1.211.2.1 --- phpweb/links.php:1.211 Thu May 22 20:25:40 2008 +++ phpweb/links.php Tue Aug 19 22:03:01 2008 @@ -1,8 +1,11 @@ <?php -// $Id: links.php,v 1.211 2008/05/22 20:25:40 bjori Exp $ +// $Id: links.php,v 1.211.2.1 2008/08/19 22:03:01 bjori Exp $ $_SERVER['BASE_PAGE'] = 'links.php'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; -$SIDEBAR_DATA = ' +include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; + +site_header("Links"); +column_box(COLUMN_LEFT); +?> <h3>Support tips and links</h3> <p> We suggest you visit <a href="/support.php">our support page</a> @@ -16,8 +19,10 @@ <a href="/software">list of software</a> available under the PHP license. </p> -'; -site_header("Links"); + +<?php +column_box(); +column_box(COLUMN_MAIN); ?> <h1>PHP Related Links</h1> @@ -49,6 +54,9 @@ </li> </ul> +<?php echo $END_BLOCK_INFO_CORNERS ?> +<?php echo $START_BLOCK_INFO_CORNERS ?> + <a name="magazines"></a> <h4>PHP Magazines</h4> @@ -81,6 +89,9 @@ </ul> +<?php echo $END_BLOCK_INFO_CORNERS ?> +<?php echo $START_BLOCK_INFO_CORNERS ?> + <a name="merchandise"></a> <h4>PHP Merchandise</h4> @@ -95,6 +106,9 @@ </li> </ul> +<?php echo $END_BLOCK_INFO_CORNERS ?> +<?php echo $START_BLOCK_INFO_CORNERS ?> + <a name="nonenglish"></a> <h4>Non-English PHP Sites</h4> @@ -434,5 +448,7 @@ </li> </ul> +<?php +column_box(); +site_footer(); -<?php site_footer(); ?> http://cvs.php.net/viewvc.cgi/phpweb/my.php?r1=1.36&r2=1.36.2.1&diff_format=u Index: phpweb/my.php diff -u phpweb/my.php:1.36 phpweb/my.php:1.36.2.1 --- phpweb/my.php:1.36 Thu Apr 10 18:41:13 2008 +++ phpweb/my.php Tue Aug 19 22:03:01 2008 @@ -1,7 +1,7 @@ <?php -// $Id: my.php,v 1.36 2008/04/10 18:41:13 philip Exp $ +// $Id: my.php,v 1.36.2.1 2008/08/19 22:03:01 bjori Exp $ $_SERVER['BASE_PAGE'] = 'my.php'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; // Try to make this page non-cached header_nocache(); @@ -70,6 +70,8 @@ myphpnet_save(); site_header("My PHP.net"); + +column_box(COLUMN_MAIN); ?> <form action="/my.php" method="post"> @@ -274,4 +276,7 @@ </p> </form> -<?php site_footer(); ?> +<?php +column_box(); +site_footer(); + http://cvs.php.net/viewvc.cgi/phpweb/sites.php?r1=1.46&r2=1.46.2.1&diff_format=u Index: phpweb/sites.php diff -u phpweb/sites.php:1.46 phpweb/sites.php:1.46.2.1 --- phpweb/sites.php:1.46 Fri Apr 11 04:56:02 2008 +++ phpweb/sites.php Tue Aug 19 22:03:01 2008 @@ -1,8 +1,11 @@ <?php -// $Id: sites.php,v 1.46 2008/04/11 04:56:02 philip Exp $ +// $Id: sites.php,v 1.46.2.1 2008/08/19 22:03:01 bjori Exp $ $_SERVER['BASE_PAGE'] = 'sites.php'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; -$SIDEBAR_DATA = ' +include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; + +site_header("A Tourist's Guide"); +column_box(COLUMN_LEFT); +?> <h3>PHP.net Sitemap</h3> <p> It might also be a good idea to dig deeper into @@ -17,8 +20,10 @@ Our <a href="/links.php">links page</a> offers some start pages you will find interesting. </p> -'; -site_header("A Tourist's Guide"); + +<?php +column_box(); +column_box(COLUMN_MAIN); ?> <h1>PHP.net: A Tourist's Guide</h1> @@ -215,4 +220,8 @@ has a wiki section and everyone is able to apply for wiki commit access. </p> -<?php site_footer(); ?> +<?php +column_box(); + +site_footer(); + http://cvs.php.net/viewvc.cgi/phpweb/support.php?r1=1.81&r2=1.81.2.1&diff_format=u Index: phpweb/support.php diff -u phpweb/support.php:1.81 phpweb/support.php:1.81.2.1 --- phpweb/support.php:1.81 Tue Apr 22 17:35:48 2008 +++ phpweb/support.php Tue Aug 19 22:03:01 2008 @@ -1,17 +1,19 @@ <?php -// $Id: support.php,v 1.81 2008/04/22 17:35:48 bjori Exp $ +// $Id: support.php,v 1.81.2.1 2008/08/19 22:03:01 bjori Exp $ $_SERVER['BASE_PAGE'] = 'support.php'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; + site_header("Getting Help"); +column_box(COLUMN_MAIN); ?> <h1>Documentation</h1> <p> - A good place to start is by skimming through the ever-growing list of <a - href="/FAQ.php">frequently asked questions (with answers, of course)</a>. Then - have a look at the rest of the online manual and other resources in the <a - href="/docs.php">documentation</a> section. + A good place to start is by skimming through the ever-growing list of + <a href="/FAQ.php">frequently asked questions (with answers, of course)</a>. + Then have a look at the rest of the online manual and other resources in the + <a href="/docs.php">documentation</a> section. </p> <h1>Books</h1> @@ -118,4 +120,8 @@ questions. </p> -<?php site_footer(); ?> +<?php +column_box(); + +site_footer(); + http://cvs.php.net/viewvc.cgi/phpweb/conferences/index.php?r1=1.24&r2=1.24.2.1&diff_format=u Index: phpweb/conferences/index.php diff -u phpweb/conferences/index.php:1.24 phpweb/conferences/index.php:1.24.2.1 --- phpweb/conferences/index.php:1.24 Tue Mar 18 14:26:30 2008 +++ phpweb/conferences/index.php Tue Aug 19 22:03:01 2008 @@ -1,29 +1,34 @@ <?php -// $Id: index.php,v 1.24 2008/03/18 14:26:30 bjori Exp $ +// $Id: index.php,v 1.24.2.1 2008/08/19 22:03:01 bjori Exp $ $_SERVER['BASE_PAGE'] = 'conferences/index.php'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-events.inc'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-news.inc'; - - -$layout_workaround = <<< EOT -<div id="conferencesSidebar"> - <div id="contact"> - <p> - Are you planning a PHP related conference and want it listed here? - <a href="/contact">Let us know.</a> - </p> - </div> - $RSIDEBAR_DATA +include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-events.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-news.inc'; + +site_header("PHP Conferences around the world", array( + 'headtags' => '<link rel="alternate" type="application/atom+xml" title="PHP: Conference announcements" href="' . $MYSITE . 'feed.atom" />', +)); + + +column_box(COLUMN_LEFT); +?> +<div id="contact"> + <p> + Are you planning a PHP related conference and want it listed here? + <a href="/contact">Let us know.</a> + </p> </div> -EOT; +<?php +echo $EVENTS_DATA; -unset($RSIDEBAR_DATA); - -site_header("PHP Conferences around the world", array("layout_workaround" => $layout_workaround, 'headtags' => '<link rel="alternate" type="application/atom+xml" title="PHP: Conference announcements" href="' . $MYSITE . 'feed.atom" />')); +column_box(); +column(COLUMN_MAIN); print_news($NEWS_ENTRIES, array("conferences", "cfp"), 10); - +?> + <p class="t-center"><a href="/archive/index.php"><strong>News Archive</strong></a></p> +<?php +column(); site_footer( array("atom" => "/feed.atom") // Add a link to the feed ); http://cvs.php.net/viewvc.cgi/phpweb/include/layout.inc?r1=1.287.2.1&r2=1.287.2.2&diff_format=u Index: phpweb/include/layout.inc diff -u phpweb/include/layout.inc:1.287.2.1 phpweb/include/layout.inc:1.287.2.2 --- phpweb/include/layout.inc:1.287.2.1 Sun Aug 17 16:01:51 2008 +++ phpweb/include/layout.inc Tue Aug 19 22:03:01 2008 @@ -1,5 +1,5 @@ <?php -/* $Id: layout.inc,v 1.287.2.1 2008/08/17 16:01:51 bjori Exp $ */ +/* $Id: layout.inc,v 1.287.2.2 2008/08/19 22:03:01 bjori Exp $ */ // Set the static content root differently on php.net $_SERVER['STATIC_ROOT'] = ($MYSITE == 'http://www.php.net/') ? @@ -60,19 +60,13 @@ function site_header($title = '', $config = array()) { - global $EXPL_LANG, $SIDEBAR_DATA, $PAGE_COLUMNS, $PGI, $PRE_DATA; + global $EXPL_LANG, $PGI, $PRE_DATA; // Default to empty array if improper parameter passed if (!is_array($config)) { $config = array(); } // String defaults - $lang_input = $base = $meta = $layout_helper = ''; - - // Count number of columns for layout. The number identifies - // the layout precisely, as we have no page having a right - // sidebar and no left sidebar - $PAGE_COLUMNS = 1; - if (!empty($SIDEBAR_DATA)) { $PAGE_COLUMNS++; } + $lang_input = $base = $meta = ''; // Print out lang and charset headers if (!isset($config["lang"])) { $config["lang"] = "en"; } @@ -116,11 +110,6 @@ $base = "\n <base href=\"{$_SERVER['BASE_HREF']}\" />"; } - // Define layout helper in case we need it - if ($PAGE_COLUMNS > 2) { - $layout_helper = "<div id=\"layout_{$PAGE_COLUMNS}_helper\">"; - } - // Choose name of mirror site specific CSS file $mirror_specific_style = ($_SERVER['STATIC_ROOT'] ? 'phpnet' : 'mirror'); @@ -227,21 +216,11 @@ <li class="last"><a href="/my.php">My Php.net</a></li> </ul> </li><!--#main-menu--> - -END_HEADER; - - echo $PRE_DATA; - - // Print out left column - if ($PAGE_COLUMNS > 1) { -echo ' + $PRE_DATA <li id="content"> <ul id="content-columns"> - <li id="left-column"> - ' . $SIDEBAR_DATA . ' - </li>'; - } - + +END_HEADER; } // Stats pages still need this @@ -249,7 +228,7 @@ function site_footer($config = array()) { - global $LAST_UPDATED, $PAGE_COLUMNS, $RSIDEBAR_DATA; + global $LAST_UPDATED; $stats = (have_stats() ? "\n <li><a href=\"/stats/\">stats</a></li>" : ""); $rsslink = (isset($config["rss"]) ? @@ -269,14 +248,6 @@ $last_updated = strftime("%c %Z", $LAST_UPDATED); //$functionsjs = (in_array("functionsjs", $config) ? "\n<script src=\"" . $_SERVER['STATIC_ROOT'] . '/functions.js" type="text/javascript"></script>' : ''); - // Print out right column - if ($RSIDEBAR_DATA) { -echo ' - <li id="right-column"> - ' . $RSIDEBAR_DATA . ' - </li>'; - } - print <<<END_FOOTER </ul> <!-- #content-columns --> @@ -646,7 +617,7 @@ function print_news($news, $dog, $max = 5) { $count = 0; foreach($news as $item) { - $vevent = ""; + $extra = array("hentry"); $ok = false; // Only print entries in the provided s/dog/cat/ egory @@ -657,7 +628,7 @@ ++$count; } if ($category["term"] === "conferences" || $category["term"] === "cfp") { - $vevent = " vevent"; + $extra[] = "vevent"; } } if ($count > $max) { @@ -691,18 +662,169 @@ $published = substr($item["published"], 0, 10); $newsdate = date("d-M-Y", strtotime($published)); - echo <<< EOT - <div class="block"><span class="corners-top"><span></span></span> - <div class="info hentry{$vevent}"> + echo block_info_start(CORNERS_TOP, $extra); + echo <<< EOT <h3 class="summary entry-title"><a name="{$id}" id="{$id}" href="{$permlink}" rel="bookmark" class="bookmark">{$item["title"]}</a></h3> <p class="news-date"><abbr class="published newsdate" title="{$item["published"]}">$newsdate</abbr></p> <div class="newsImage">{$image}</div> {$item["content"]} - </div> - </div><!--.block--> EOT; + echo block_info_end(CORNERS_NONE); } } + +// {{{ Layout boxes +define("CORNERS_NONE", 0x00); // Don't print out the rounded corners +define("CORNERS_TOP", 0x01); // Print out rounded corners at the top +define("CORNERS_BOTTOM", 0x02); // Print out rounded corners at the bottom + +define("COLUMN_LEFT", 1); // First column (left sidebar) +define("COLUMN_MAIN" 2); // Main content column in 2 column view +define("COLUMN_MIDDLE" 3); // Second column in 3 column view +define("COLUMN_RIGHT" 4); // Third column (right sidebar) + +// I am extremely lazy and have a piss poor copy&paste skilz. +// Better of opening/closing these layout boxes using help functions + +// Print a layout column (COLUMN_*) +function column($id = "") { + static $columns = array( + COLUMN_LEFT => "left", + COLUMN_MAIN => "main", + COLUMN_MIDDLE => "mid", + COLUMN_RIGHT => "right", + ); + if (isset($columns[$id])) { + $id = $columns[$id] . "-column"; + echo <<< OPEN + <li id="$id"> + <div class="content"> + +OPEN; + return true; + } + if($id === false) { + echo <<< CLOSE + </div> <!-- .content --> + </li><!-- #id.. --> + +CLOSE; + return true; + } + + trigger_error("Unknown column passed ($id), not printing any markup", E_USER_WARNING); + return false; + +} + +// Print out a box (CORNERS_*) +// $classes can be used to add specific CSS classes to the div elements +function box($corners = CORNERS_NONE, $classes = array()) { + static $defaults = array( + "block" => array("block"), + "info" => array("info"), + "corners" => array("corners-top"), + ); + // Previous CORNERS_ settings + static $stack = array(); + // Merge the default CSS classnames with $classes + $classes = array_merge_recursive($defaults, $classes); + + // No args == closing column + $open = !(func_num_args() == 0); + + if ($open) { + $block = ' <div class="' .join(" ", $classes["block"]). '"><!-- .block -->'; + $info = ' <div class="' .join(" ", $classes["info"]). '"><!-- .info -->'; + $top = ' <span class="' .join(" ", $classes["corners"]). '"><span></span></span>'; + + $stack[] = $corners; + if ($corners == CORNERS_NONE) { + echo "$block\n$info\n"; + return; + } + echo "$block\n$top\n$info\n"; + return; + } + + $corners = array_pop($stack); + + $info = ' </div><!-- .info -->'; + $bottom = ' <span class="corners-bottom"><span></span></span>'; + $block = ' </div><!-- .block -->'; + + if ($corners == CORNERS_NONE) { + echo "$info\n$block\n"; + return; + } + echo "$info\n$bottom\n$block\n"; +} + +// Wrapper for column(COLUMN_*); box(CORNERS_*); (and box(); column();) +// $extra is contains for the moment only one option key, "classes", see box() +function column_box($column = "", $corners = CORNERS_TOP, $extra = array()) { + static $defaults = array( + "classes" => array(), + ); + + $extra = array_merge_recursive($defaults, $extra); + + // No args == closing column + $open = !(func_num_args() == 0); + + if ($open) { + column($column); + box($corners, $extra["classes"]); + } else { + box(); + column(); + } +} + + +function block_info_start($corners = CORNERS_NONE, $classes = array()) { + static $defaults = array( + "block" => array("block"), + "info" => array("info"), + "corners" => array("corners-top"), + ); + $classes = array_merge_recursive($defaults, $classes); + + $block = ' <div class="' .join(" ", $classes["block"]). '"><!-- .block -->'; + $info = ' <div class="' .join(" ", $classes["info"]). '"><!-- .info -->'; + $top = ' <span class="' .join(" ", $classes["corners"]). '"><span></span></span>'; + + if ($corners == CORNERS_NONE) { + return "$block\n$info\n"; + } + if ($corners == CORNERS_TOP) { + return "$block\n$top\n$info\n"; + } +} + +function block_info_end($corners = CORNERS_NONE) { + $info = ' </div><!-- .info -->'; + $bottom = ' <span class="corners-bottom"><span></span></span>'; + $block = ' </div><!-- .block -->'; + + if ($corners == CORNERS_NONE) { + return "$info\n$block\n"; + } + if ($corners == CORNERS_BOTTOM) { + return "$info\n$bottom\n$block\n"; + } +} + +// Yes. I'm seriusly _THAT_ lazy :D +$START_BLOCK_INFO_CORNERS = block_info_start(CORNERS_TOP); +$END_BLOCK_INFO_CORNERS = block_info_end(CORNERS_BOTTOM); + +$START_BLOCK_INFO = block_info_start(CORNERS_NONE); +$END_BLOCK_INFO = block_info_end(CORNERS_NONE); + +// }}} + + /* vim: set et ts=4 sw=4 ft=php: : */ http://cvs.php.net/viewvc.cgi/phpweb/include/shared-manual.inc?r1=1.240.2.1&r2=1.240.2.2&diff_format=u Index: phpweb/include/shared-manual.inc diff -u phpweb/include/shared-manual.inc:1.240.2.1 phpweb/include/shared-manual.inc:1.240.2.2 --- phpweb/include/shared-manual.inc:1.240.2.1 Sun Aug 17 16:01:51 2008 +++ phpweb/include/shared-manual.inc Tue Aug 19 22:03:02 2008 @@ -1,6 +1,6 @@ <?php // -*- C++ -*- -// $Id: shared-manual.inc,v 1.240.2.1 2008/08/17 16:01:51 bjori Exp $ +// $Id: shared-manual.inc,v 1.240.2.2 2008/08/19 22:03:02 bjori Exp $ /* @@ -15,7 +15,7 @@ */ // Ensure that our environment is set up -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; // Set variable defaults $PGI = array(); $SIDEBAR_DATA = '';
http://cvs.php.net/viewvc.cgi/phpweb/docs.php?r1=1.145&r2=1.145.2.1&diff_format=u Index: phpweb/docs.php diff -u phpweb/docs.php:1.145 phpweb/docs.php:1.145.2.1 --- phpweb/docs.php:1.145 Fri Apr 11 15:26:21 2008 +++ phpweb/docs.php Tue Aug 19 22:03:01 2008 @@ -1,13 +1,17 @@ <?php -// $Id: docs.php,v 1.145 2008/04/11 15:26:21 bjori Exp $ +// $Id: docs.php,v 1.145.2.1 2008/08/19 22:03:01 bjori Exp $ $_SERVER['BASE_PAGE'] = 'docs.php'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; -$SIDEBAR_DATA=' + +site_header("Documentation"); + +column_box(COLUMN_LEFT); +?> <h3>FAQ</h3> <p> The <a href="/FAQ.php">PHP FAQ</a> is your first stop for general - information and those questions that seem to be on most people\'s minds. + information and those questions that seem to be on most people's minds. If you have licensing questions, see the separate <a href="/license/">License FAQ</a>. </p> @@ -37,10 +41,11 @@ great places to find many example scripts and useful functions, organized for your searching pleasure! </p> -'; -site_header("Documentation"); +<?php +column_box(); +column_box(COLUMN_MAIN); ?> <h1>Documentation</h1> @@ -122,4 +127,8 @@ </li> </ul> -<?php site_footer(); +<?php +column_box(); + +site_footer(); + http://cvs.php.net/viewvc.cgi/phpweb/index.php?r1=1.909.2.1&r2=1.909.2.2&diff_format=u Index: phpweb/index.php diff -u phpweb/index.php:1.909.2.1 phpweb/index.php:1.909.2.2 --- phpweb/index.php:1.909.2.1 Sun Aug 17 16:01:50 2008 +++ phpweb/index.php Tue Aug 19 22:03:01 2008 @@ -1,10 +1,8 @@ -<?php // vim: et +<?php // vim: et fdm=marker /* - If you're reading this, it isn't because you've found a security hole. - this is an open source website. read and learn! -*/ - -/* ------------------------------------------------------------------------- */ + * No. You did not find a security hole. + * This is an open source website. + */ // Modified headers {{{ // Get the modification date of this PHP file @@ -45,18 +43,63 @@ // }}} $_SERVER['BASE_PAGE'] = 'index.php'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-events.inc'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-confs.inc'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-news.inc'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/version.inc'; - -// This goes to the left sidebar of the front page {{{ -$SIDEBAR_DATA = ' -<div class="content"> - <div class="block"> - <span class="corners-top"><span></span></span> - <div class="info"> +include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-events.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-confs.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-news.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/version.inc'; + +// Generate conference teaser {{{ +if (is_array($CONF_TEASER) && count($CONF_TEASER)) { + $categories = array("conference" => "Upcoming conferences", "cfp" => "Calling for papers"); + $teaser = ' <li id="news-line"><span class="corners-top"><span></span></span><ul>' . "\n"; + foreach($CONF_TEASER as $k => $a) { + if (is_array($a) && count($a)) { + $teaser .= " <li><span>" . $categories[$k] . "</span>\n"; + $teaser .= " <ul>"; + $count = 0; + $a = preg_replace("'([A-Za-z0-9])([\s\:\-\,]*?)call for(.*?)$'i", "$1", $a); + foreach($a as $url => $title) { + if ($count++ >= 4) { + break; + } + $teaser .= ' <li class="first last"><a href="' . $url. '">' . $title. '</a></li>' . "\n"; + } + $teaser .= " </ul>\n </li>\n"; + } // if set + } + $teaser .= ' </ul><span class="corners-bottom"><span></span></span></li><!-- #news-line -->'."\n"; + $PRE_DATA = $teaser; +} // }}} + +// Write out common header {{{ +site_header("Hypertext Preprocessor", + array( + 'onload' => 'boldEvents();', + 'headtags' => '<link rel="alternate" type="application/atom+xml" title="PHP: Hypertext Preprocessor" href="' . $MYSITE . 'feed.atom" />', + 'link' => array( + array( + "rel" => "search", + "type" => "application/opensearchdescription+xml", + "href" => $MYSITE . "phpnetimprovedsearch.src", + "title" => "Add PHP.net search" + ), + array( + "rel" => "alternate", + "type" => "application/atom+xml", + "href" => $MYSITE . "releases.atom", + "title" => "PHP Release feed" + ), + + ), + ) +); +// }}} + +// {{{ Left sidebar ("What is PHP" & "Thanks to") + +column_box(COLUMN_LEFT); +?> <h3>What is PHP?</h3> <p> @@ -69,11 +112,7 @@ and the example archive sites and some of the other resources available in the <a href="/links.php">links section</a>. </p> -</div> -</div><!-- .block--> - - <div class="block"> - <div class="info"> +<?php echo $END_BLOCK_INFO, $START_BLOCK_INFO; ?> <h3><a href="/thanks.php">Thanks To</a></h3> <ul class="simple"> @@ -96,13 +135,25 @@ <p> You can grab our news as an <a href="/feed.atom">Atom feed</a>. </p> - </div><!--.block--> - <span class="corners-bottom"><span></span></span> - </div> - </div> -'; + +<?php +column_box(); + // }}} +// {{{ News (include/pregen-news.inc) +column(COLUMN_MIDDLE); + +// $NEWS_ENTRIES is generated on master (scripts/pregen_news) from archive/*.xml +print_news($NEWS_ENTRIES, "frontpage"); +echo '<p class="t-center"><a href="/archive/index.php"><strong>News Archive</strong></a></p>'; + +column(); +// }}} + +// Right column (releases/events..) {{{ +column_box(COLUMN_RIGHT, true, array("classes" => array("block" => array("releases")))); + $MIRROR_IMAGE = ''; // Try to find a sponsor image in case this is an official mirror {{{ @@ -154,129 +205,59 @@ list($PHP_5_RC, ) = each($RELEASES[5]); } +?> -$release_box = <<< RELEASE_DATA - <div class="content"> - <div class="block releases"><span class="corners-top"><span></span></span> - <div class="info"> <h3>Stable releases</h3> - <p class="first">Current PHP 5 Stable: <a href="/ChangeLog-5.php#$PHP_5_STABLE"><strong>$PHP_5_STABLE</strong></a></p> + <p class="first">Current PHP 5 Stable: <a href="/ChangeLog-5.php#<?php echo $PHP_5_STABLE ?>"><strong><?php echo $PHP_5_STABLE ?></strong></a></p> <p class="download-button"><a href="/downloads.php#v5"><span>Download</span></a></p> <p class="top-border">Historical PHP Stable: <a href="/downloads.php#v4"><strong>4.4.9</strong></a></p> -RELEASE_DATA; - -if ($PHP_5_RC) { - $release_box .= <<< RELEASE_DATA +<?php +if ($PHP_5_RC): +?> <h4>Release Candidates</h4> - <p class="top-border"><a href="http://qa.php.net/">$PHP_5_RC</a></p> -RELEASE_DATA; -} -$release_box .= <<< RELEASE_DATA + <p class="top-border"><a href="http://qa.php.net/"><?php echo $PHP_5_RC ?></a></p> +<?php +endif; +?> <p><a href="/downloads.php"><strong>Download area »</strong></a></p> - </div><!-- .info --> - </div><!--.block--> -RELEASE_DATA; + <?php echo $END_BLOCK_INFO ?> +<?php /* }}} */ // Generate the event box {{{ -$upcoming_events = <<< UPCOMING_EVENTS - <div class="block"> - <div class="info"> +?> + <?php echo $START_BLOCK_INFO ?> <h3 class="upcoming-events">Upcoming Events</h3> - <div class="calendar"><span class="corners-top"><span></span></span> + <div class="calendar"> + <span class="corners-top"><span></span></span> <h4>Events Calendar</h4> <form method="get" action="/cal.php"> <p> <select class="month" name="cm"> -UPCOMING_EVENTS; - +<?php $months = array(1 => "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); $current = date("m", $_SERVER["REQUEST_TIME"]); foreach($months as $n => $month) { - $upcoming_events .= "<option value='$n' ". ($n == $current ? 'selected="selected"' : '') .">$month</option>\n"; + echo "<option value='$n' ". ($n == $current ? 'selected="selected"' : '') .">$month</option>\n"; } - -$upcoming_events .= <<< UPCOMING_EVENTS +?> </select> <span><input type="submit" class="button" value="View" /></span> </p> </form> - <span class="corners-bottom"><span></span></span></div> - <p class="add-event"><a href="/submit-event.php"><strong>Add event »</strong></a></p> - <div class="events"> - $EVENTS_DATA - </div> + <span class="corners-bottom"><span></span></span> </div><!-- .calendar --> - </div><!-- .info --> - </div><!-- .block --> -UPCOMING_EVENTS; + <p class="add-event"><a href="/submit-event.php"><strong>Add event »</strong></a></p> + <div class="events"> + <?php echo $EVENTS_DATA ?> + </div> +<?php // }}} -// Prepend mirror image & latest releases to sidebar text -$RSIDEBAR_DATA = $MIRROR_IMAGE . $release_box . $upcoming_events; - -// Generate conference teaser {{{ -if (is_array($CONF_TEASER) && count($CONF_TEASER)) { - $categories = array("conference" => "Upcoming conferences", "cfp" => "Calling for papers"); - $teaser = ' <li id="news-line"><span class="corners-top"><span></span></span><ul>' . "\n"; - foreach($CONF_TEASER as $k => $a) { - if (is_array($a) && count($a)) { - $teaser .= " <li><span>" . $categories[$k] . "</span>\n"; - $teaser .= " <ul>"; - $count = 0; - $a = preg_replace("'([A-Za-z0-9])([\s\:\-\,]*?)call for(.*?)$'i", "$1", $a); - foreach($a as $url => $title) { - if ($count++ >= 4) { - break; - } - $teaser .= ' <li class="first last"><a href="' . $url. '">' . $title. '</a></li>' . "\n"; - } - $teaser .= " </ul>\n </li>\n"; - } // if set - } - $teaser .= ' </ul><span class="corners-bottom"><span></span></span></li><!-- #news-line -->'."\n"; - $PRE_DATA = $teaser; -} // }}} - -// Write out common header {{{ -site_header("Hypertext Preprocessor", - array( - 'onload' => 'boldEvents();', - 'headtags' => '<link rel="alternate" type="application/atom+xml" title="PHP: Hypertext Preprocessor" href="' . $MYSITE . 'feed.atom" />', - 'link' => array( - array( - "rel" => "search", - "type" => "application/opensearchdescription+xml", - "href" => $MYSITE . "phpnetimprovedsearch.src", - "title" => "Add PHP.net search" - ), - array( - "rel" => "alternate", - "type" => "application/atom+xml", - "href" => $MYSITE . "releases.atom", - "title" => "PHP Release feed" - ), - - ), - ) -); +column_box(); // }}} -?> - <li id="mid-column"> - <div class="content"> -<?php -/* Where the h*ll did all the news go? - * See ./bin/createNewsEntry - */ -print_news($NEWS_ENTRIES, "frontpage"); -?> - <p class="t-center"><a href="/archive/index.php"><strong>News Archive</strong></a></p> - </div> - </li><!-- #mid-column--> - -<?php site_footer( array("atom" => "/feed.atom") // Add a link to the feed at the bottom ); http://cvs.php.net/viewvc.cgi/phpweb/links.php?r1=1.211&r2=1.211.2.1&diff_format=u Index: phpweb/links.php diff -u phpweb/links.php:1.211 phpweb/links.php:1.211.2.1 --- phpweb/links.php:1.211 Thu May 22 20:25:40 2008 +++ phpweb/links.php Tue Aug 19 22:03:01 2008 @@ -1,8 +1,11 @@ <?php -// $Id: links.php,v 1.211 2008/05/22 20:25:40 bjori Exp $ +// $Id: links.php,v 1.211.2.1 2008/08/19 22:03:01 bjori Exp $ $_SERVER['BASE_PAGE'] = 'links.php'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; -$SIDEBAR_DATA = ' +include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; + +site_header("Links"); +column_box(COLUMN_LEFT); +?> <h3>Support tips and links</h3> <p> We suggest you visit <a href="/support.php">our support page</a> @@ -16,8 +19,10 @@ <a href="/software">list of software</a> available under the PHP license. </p> -'; -site_header("Links"); + +<?php +column_box(); +column_box(COLUMN_MAIN); ?> <h1>PHP Related Links</h1> @@ -49,6 +54,9 @@ </li> </ul> +<?php echo $END_BLOCK_INFO_CORNERS ?> +<?php echo $START_BLOCK_INFO_CORNERS ?> + <a name="magazines"></a> <h4>PHP Magazines</h4> @@ -81,6 +89,9 @@ </ul> +<?php echo $END_BLOCK_INFO_CORNERS ?> +<?php echo $START_BLOCK_INFO_CORNERS ?> + <a name="merchandise"></a> <h4>PHP Merchandise</h4> @@ -95,6 +106,9 @@ </li> </ul> +<?php echo $END_BLOCK_INFO_CORNERS ?> +<?php echo $START_BLOCK_INFO_CORNERS ?> + <a name="nonenglish"></a> <h4>Non-English PHP Sites</h4> @@ -434,5 +448,7 @@ </li> </ul> +<?php +column_box(); +site_footer(); -<?php site_footer(); ?> http://cvs.php.net/viewvc.cgi/phpweb/my.php?r1=1.36&r2=1.36.2.1&diff_format=u Index: phpweb/my.php diff -u phpweb/my.php:1.36 phpweb/my.php:1.36.2.1 --- phpweb/my.php:1.36 Thu Apr 10 18:41:13 2008 +++ phpweb/my.php Tue Aug 19 22:03:01 2008 @@ -1,7 +1,7 @@ <?php -// $Id: my.php,v 1.36 2008/04/10 18:41:13 philip Exp $ +// $Id: my.php,v 1.36.2.1 2008/08/19 22:03:01 bjori Exp $ $_SERVER['BASE_PAGE'] = 'my.php'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; // Try to make this page non-cached header_nocache(); @@ -70,6 +70,8 @@ myphpnet_save(); site_header("My PHP.net"); + +column_box(COLUMN_MAIN); ?> <form action="/my.php" method="post"> @@ -274,4 +276,7 @@ </p> </form> -<?php site_footer(); ?> +<?php +column_box(); +site_footer(); + http://cvs.php.net/viewvc.cgi/phpweb/sites.php?r1=1.46&r2=1.46.2.1&diff_format=u Index: phpweb/sites.php diff -u phpweb/sites.php:1.46 phpweb/sites.php:1.46.2.1 --- phpweb/sites.php:1.46 Fri Apr 11 04:56:02 2008 +++ phpweb/sites.php Tue Aug 19 22:03:01 2008 @@ -1,8 +1,11 @@ <?php -// $Id: sites.php,v 1.46 2008/04/11 04:56:02 philip Exp $ +// $Id: sites.php,v 1.46.2.1 2008/08/19 22:03:01 bjori Exp $ $_SERVER['BASE_PAGE'] = 'sites.php'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; -$SIDEBAR_DATA = ' +include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; + +site_header("A Tourist's Guide"); +column_box(COLUMN_LEFT); +?> <h3>PHP.net Sitemap</h3> <p> It might also be a good idea to dig deeper into @@ -17,8 +20,10 @@ Our <a href="/links.php">links page</a> offers some start pages you will find interesting. </p> -'; -site_header("A Tourist's Guide"); + +<?php +column_box(); +column_box(COLUMN_MAIN); ?> <h1>PHP.net: A Tourist's Guide</h1> @@ -215,4 +220,8 @@ has a wiki section and everyone is able to apply for wiki commit access. </p> -<?php site_footer(); ?> +<?php +column_box(); + +site_footer(); + http://cvs.php.net/viewvc.cgi/phpweb/support.php?r1=1.81&r2=1.81.2.1&diff_format=u Index: phpweb/support.php diff -u phpweb/support.php:1.81 phpweb/support.php:1.81.2.1 --- phpweb/support.php:1.81 Tue Apr 22 17:35:48 2008 +++ phpweb/support.php Tue Aug 19 22:03:01 2008 @@ -1,17 +1,19 @@ <?php -// $Id: support.php,v 1.81 2008/04/22 17:35:48 bjori Exp $ +// $Id: support.php,v 1.81.2.1 2008/08/19 22:03:01 bjori Exp $ $_SERVER['BASE_PAGE'] = 'support.php'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; + site_header("Getting Help"); +column_box(COLUMN_MAIN); ?> <h1>Documentation</h1> <p> - A good place to start is by skimming through the ever-growing list of <a - href="/FAQ.php">frequently asked questions (with answers, of course)</a>. Then - have a look at the rest of the online manual and other resources in the <a - href="/docs.php">documentation</a> section. + A good place to start is by skimming through the ever-growing list of + <a href="/FAQ.php">frequently asked questions (with answers, of course)</a>. + Then have a look at the rest of the online manual and other resources in the + <a href="/docs.php">documentation</a> section. </p> <h1>Books</h1> @@ -118,4 +120,8 @@ questions. </p> -<?php site_footer(); ?> +<?php +column_box(); + +site_footer(); + http://cvs.php.net/viewvc.cgi/phpweb/conferences/index.php?r1=1.24&r2=1.24.2.1&diff_format=u Index: phpweb/conferences/index.php diff -u phpweb/conferences/index.php:1.24 phpweb/conferences/index.php:1.24.2.1 --- phpweb/conferences/index.php:1.24 Tue Mar 18 14:26:30 2008 +++ phpweb/conferences/index.php Tue Aug 19 22:03:01 2008 @@ -1,29 +1,34 @@ <?php -// $Id: index.php,v 1.24 2008/03/18 14:26:30 bjori Exp $ +// $Id: index.php,v 1.24.2.1 2008/08/19 22:03:01 bjori Exp $ $_SERVER['BASE_PAGE'] = 'conferences/index.php'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-events.inc'; -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-news.inc'; - - -$layout_workaround = <<< EOT -<div id="conferencesSidebar"> - <div id="contact"> - <p> - Are you planning a PHP related conference and want it listed here? - <a href="/contact">Let us know.</a> - </p> - </div> - $RSIDEBAR_DATA +include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-events.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/pregen-news.inc'; + +site_header("PHP Conferences around the world", array( + 'headtags' => '<link rel="alternate" type="application/atom+xml" title="PHP: Conference announcements" href="' . $MYSITE . 'feed.atom" />', +)); + + +column_box(COLUMN_LEFT); +?> +<div id="contact"> + <p> + Are you planning a PHP related conference and want it listed here? + <a href="/contact">Let us know.</a> + </p> </div> -EOT; +<?php +echo $EVENTS_DATA; -unset($RSIDEBAR_DATA); - -site_header("PHP Conferences around the world", array("layout_workaround" => $layout_workaround, 'headtags' => '<link rel="alternate" type="application/atom+xml" title="PHP: Conference announcements" href="' . $MYSITE . 'feed.atom" />')); +column_box(); +column(COLUMN_MAIN); print_news($NEWS_ENTRIES, array("conferences", "cfp"), 10); - +?> + <p class="t-center"><a href="/archive/index.php"><strong>News Archive</strong></a></p> +<?php +column(); site_footer( array("atom" => "/feed.atom") // Add a link to the feed ); http://cvs.php.net/viewvc.cgi/phpweb/include/layout.inc?r1=1.287.2.1&r2=1.287.2.2&diff_format=u Index: phpweb/include/layout.inc diff -u phpweb/include/layout.inc:1.287.2.1 phpweb/include/layout.inc:1.287.2.2 --- phpweb/include/layout.inc:1.287.2.1 Sun Aug 17 16:01:51 2008 +++ phpweb/include/layout.inc Tue Aug 19 22:03:01 2008 @@ -1,5 +1,5 @@ <?php -/* $Id: layout.inc,v 1.287.2.1 2008/08/17 16:01:51 bjori Exp $ */ +/* $Id: layout.inc,v 1.287.2.2 2008/08/19 22:03:01 bjori Exp $ */ // Set the static content root differently on php.net $_SERVER['STATIC_ROOT'] = ($MYSITE == 'http://www.php.net/') ? @@ -60,19 +60,13 @@ function site_header($title = '', $config = array()) { - global $EXPL_LANG, $SIDEBAR_DATA, $PAGE_COLUMNS, $PGI, $PRE_DATA; + global $EXPL_LANG, $PGI, $PRE_DATA; // Default to empty array if improper parameter passed if (!is_array($config)) { $config = array(); } // String defaults - $lang_input = $base = $meta = $layout_helper = ''; - - // Count number of columns for layout. The number identifies - // the layout precisely, as we have no page having a right - // sidebar and no left sidebar - $PAGE_COLUMNS = 1; - if (!empty($SIDEBAR_DATA)) { $PAGE_COLUMNS++; } + $lang_input = $base = $meta = ''; // Print out lang and charset headers if (!isset($config["lang"])) { $config["lang"] = "en"; } @@ -116,11 +110,6 @@ $base = "\n <base href=\"{$_SERVER['BASE_HREF']}\" />"; } - // Define layout helper in case we need it - if ($PAGE_COLUMNS > 2) { - $layout_helper = "<div id=\"layout_{$PAGE_COLUMNS}_helper\">"; - } - // Choose name of mirror site specific CSS file $mirror_specific_style = ($_SERVER['STATIC_ROOT'] ? 'phpnet' : 'mirror'); @@ -227,21 +216,11 @@ <li class="last"><a href="/my.php">My Php.net</a></li> </ul> </li><!--#main-menu--> - -END_HEADER; - - echo $PRE_DATA; - - // Print out left column - if ($PAGE_COLUMNS > 1) { -echo ' + $PRE_DATA <li id="content"> <ul id="content-columns"> - <li id="left-column"> - ' . $SIDEBAR_DATA . ' - </li>'; - } - + +END_HEADER; } // Stats pages still need this @@ -249,7 +228,7 @@ function site_footer($config = array()) { - global $LAST_UPDATED, $PAGE_COLUMNS, $RSIDEBAR_DATA; + global $LAST_UPDATED; $stats = (have_stats() ? "\n <li><a href=\"/stats/\">stats</a></li>" : ""); $rsslink = (isset($config["rss"]) ? @@ -269,14 +248,6 @@ $last_updated = strftime("%c %Z", $LAST_UPDATED); //$functionsjs = (in_array("functionsjs", $config) ? "\n<script src=\"" . $_SERVER['STATIC_ROOT'] . '/functions.js" type="text/javascript"></script>' : ''); - // Print out right column - if ($RSIDEBAR_DATA) { -echo ' - <li id="right-column"> - ' . $RSIDEBAR_DATA . ' - </li>'; - } - print <<<END_FOOTER </ul> <!-- #content-columns --> @@ -646,7 +617,7 @@ function print_news($news, $dog, $max = 5) { $count = 0; foreach($news as $item) { - $vevent = ""; + $extra = array("hentry"); $ok = false; // Only print entries in the provided s/dog/cat/ egory @@ -657,7 +628,7 @@ ++$count; } if ($category["term"] === "conferences" || $category["term"] === "cfp") { - $vevent = " vevent"; + $extra[] = "vevent"; } } if ($count > $max) { @@ -691,18 +662,169 @@ $published = substr($item["published"], 0, 10); $newsdate = date("d-M-Y", strtotime($published)); - echo <<< EOT - <div class="block"><span class="corners-top"><span></span></span> - <div class="info hentry{$vevent}"> + echo block_info_start(CORNERS_TOP, $extra); + echo <<< EOT <h3 class="summary entry-title"><a name="{$id}" id="{$id}" href="{$permlink}" rel="bookmark" class="bookmark">{$item["title"]}</a></h3> <p class="news-date"><abbr class="published newsdate" title="{$item["published"]}">$newsdate</abbr></p> <div class="newsImage">{$image}</div> {$item["content"]} - </div> - </div><!--.block--> EOT; + echo block_info_end(CORNERS_NONE); } } + +// {{{ Layout boxes +define("CORNERS_NONE", 0x00); // Don't print out the rounded corners +define("CORNERS_TOP", 0x01); // Print out rounded corners at the top +define("CORNERS_BOTTOM", 0x02); // Print out rounded corners at the bottom + +define("COLUMN_LEFT", 1); // First column (left sidebar) +define("COLUMN_MAIN" 2); // Main content column in 2 column view +define("COLUMN_MIDDLE" 3); // Second column in 3 column view +define("COLUMN_RIGHT" 4); // Third column (right sidebar) + +// I am extremely lazy and have a piss poor copy&paste skilz. +// Better of opening/closing these layout boxes using help functions + +// Print a layout column (COLUMN_*) +function column($id = "") { + static $columns = array( + COLUMN_LEFT => "left", + COLUMN_MAIN => "main", + COLUMN_MIDDLE => "mid", + COLUMN_RIGHT => "right", + ); + if (isset($columns[$id])) { + $id = $columns[$id] . "-column"; + echo <<< OPEN + <li id="$id"> + <div class="content"> + +OPEN; + return true; + } + if($id === false) { + echo <<< CLOSE + </div> <!-- .content --> + </li><!-- #id.. --> + +CLOSE; + return true; + } + + trigger_error("Unknown column passed ($id), not printing any markup", E_USER_WARNING); + return false; + +} + +// Print out a box (CORNERS_*) +// $classes can be used to add specific CSS classes to the div elements +function box($corners = CORNERS_NONE, $classes = array()) { + static $defaults = array( + "block" => array("block"), + "info" => array("info"), + "corners" => array("corners-top"), + ); + // Previous CORNERS_ settings + static $stack = array(); + // Merge the default CSS classnames with $classes + $classes = array_merge_recursive($defaults, $classes); + + // No args == closing column + $open = !(func_num_args() == 0); + + if ($open) { + $block = ' <div class="' .join(" ", $classes["block"]). '"><!-- .block -->'; + $info = ' <div class="' .join(" ", $classes["info"]). '"><!-- .info -->'; + $top = ' <span class="' .join(" ", $classes["corners"]). '"><span></span></span>'; + + $stack[] = $corners; + if ($corners == CORNERS_NONE) { + echo "$block\n$info\n"; + return; + } + echo "$block\n$top\n$info\n"; + return; + } + + $corners = array_pop($stack); + + $info = ' </div><!-- .info -->'; + $bottom = ' <span class="corners-bottom"><span></span></span>'; + $block = ' </div><!-- .block -->'; + + if ($corners == CORNERS_NONE) { + echo "$info\n$block\n"; + return; + } + echo "$info\n$bottom\n$block\n"; +} + +// Wrapper for column(COLUMN_*); box(CORNERS_*); (and box(); column();) +// $extra is contains for the moment only one option key, "classes", see box() +function column_box($column = "", $corners = CORNERS_TOP, $extra = array()) { + static $defaults = array( + "classes" => array(), + ); + + $extra = array_merge_recursive($defaults, $extra); + + // No args == closing column + $open = !(func_num_args() == 0); + + if ($open) { + column($column); + box($corners, $extra["classes"]); + } else { + box(); + column(); + } +} + + +function block_info_start($corners = CORNERS_NONE, $classes = array()) { + static $defaults = array( + "block" => array("block"), + "info" => array("info"), + "corners" => array("corners-top"), + ); + $classes = array_merge_recursive($defaults, $classes); + + $block = ' <div class="' .join(" ", $classes["block"]). '"><!-- .block -->'; + $info = ' <div class="' .join(" ", $classes["info"]). '"><!-- .info -->'; + $top = ' <span class="' .join(" ", $classes["corners"]). '"><span></span></span>'; + + if ($corners == CORNERS_NONE) { + return "$block\n$info\n"; + } + if ($corners == CORNERS_TOP) { + return "$block\n$top\n$info\n"; + } +} + +function block_info_end($corners = CORNERS_NONE) { + $info = ' </div><!-- .info -->'; + $bottom = ' <span class="corners-bottom"><span></span></span>'; + $block = ' </div><!-- .block -->'; + + if ($corners == CORNERS_NONE) { + return "$info\n$block\n"; + } + if ($corners == CORNERS_BOTTOM) { + return "$info\n$bottom\n$block\n"; + } +} + +// Yes. I'm seriusly _THAT_ lazy :D +$START_BLOCK_INFO_CORNERS = block_info_start(CORNERS_TOP); +$END_BLOCK_INFO_CORNERS = block_info_end(CORNERS_BOTTOM); + +$START_BLOCK_INFO = block_info_start(CORNERS_NONE); +$END_BLOCK_INFO = block_info_end(CORNERS_NONE); + +// }}} + + /* vim: set et ts=4 sw=4 ft=php: : */ http://cvs.php.net/viewvc.cgi/phpweb/include/shared-manual.inc?r1=1.240.2.1&r2=1.240.2.2&diff_format=u Index: phpweb/include/shared-manual.inc diff -u phpweb/include/shared-manual.inc:1.240.2.1 phpweb/include/shared-manual.inc:1.240.2.2 --- phpweb/include/shared-manual.inc:1.240.2.1 Sun Aug 17 16:01:51 2008 +++ phpweb/include/shared-manual.inc Tue Aug 19 22:03:02 2008 @@ -1,6 +1,6 @@ <?php // -*- C++ -*- -// $Id: shared-manual.inc,v 1.240.2.1 2008/08/17 16:01:51 bjori Exp $ +// $Id: shared-manual.inc,v 1.240.2.2 2008/08/19 22:03:02 bjori Exp $ /* @@ -15,7 +15,7 @@ */ // Ensure that our environment is set up -include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; +include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; // Set variable defaults $PGI = array(); $SIDEBAR_DATA = '';