cvs: phpweb /include layout.inc

From: Date: Sat, 23 Aug 2003 13:26:10 +0000
Subject: cvs: phpweb /include layout.inc
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-20558@lists.php.net to get a copy of this message
goba Sat Aug 23 09:26:10 2003 EDT Modified files: /phpweb/include layout.inc Log: Add support on the HTML level for two and three column layouts without tables Index: phpweb/include/layout.inc diff -u phpweb/include/layout.inc:1.188 phpweb/include/layout.inc:1.189 --- phpweb/include/layout.inc:1.188 Thu Aug 21 09:16:34 2003 +++ phpweb/include/layout.inc Sat Aug 23 09:26:10 2003 @@ -1,5 +1,5 @@ <?php -/* $Id: layout.inc,v 1.188 2003/08/21 13:16:34 goba Exp $ */ +/* $Id: layout.inc,v 1.189 2003/08/23 13:26:10 goba Exp $ */ // Set the static content root differently on php.net $_SERVER['STATIC_ROOT'] = ($MYSITE == 'http://www.php.net/') ? @@ -50,13 +50,20 @@ commonHeader and commonFooter functions in the future altogether */ function site_header($title = '', $config = array()) { - global $EXPL_LANG; + global $EXPL_LANG, $SIDEBAR_DATA, $RSIDEBAR_DATA, $PAGE_COLUMNS; // Default to empty array if improper parameter passed if (!is_array($config)) { $config = array(); } // String defaults - $lang_input = $base = $meta = ''; + $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++; } + if (!empty($RSIDEBAR_DATA)) { $PAGE_COLUMNS++; } // Print out lang and charset headers if (!isset($config["lang"])) { $config["lang"] = "en"; } @@ -86,6 +93,11 @@ $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\">"; + } + print <<<END_HEADER <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> @@ -138,22 +150,38 @@ </form> </div> -<div id="content"> +<div id="layout_{$PAGE_COLUMNS}">{$layout_helper} END_HEADER; + + // Print out left column + if ($PAGE_COLUMNS > 1) { + echo "\n <div id=\"leftbar\">\n$SIDEBAR_DATA\n </div>"; + } + + // Print out right column + if ($PAGE_COLUMNS > 2) { + echo "\n <div id=\"rightbar\">\n$RSIDEBAR_DATA\n </div>"; + } + + // Start main page content + echo "\n <div id=\"content\">\n"; } // See the comment for site_header() above function site_footer() { - global $LAST_UPDATED; + global $LAST_UPDATED, $PAGE_COLUMNS; $stats = (have_stats() ? "\n <a href=\"/stats/\">stats</a> |" : ""); $provider_url = mirror_provider_url(); $provider_name = mirror_provider(); $last_updated = strftime("%c %Z", $LAST_UPDATED); + $layout_helper = ($PAGE_COLUMNS > 2 ? "</div>" : ""); print <<<END_FOOTER -</div> + + </div> +{$layout_helper}</div> <div id="footnav"> <a href="/source.php?url=/{$_SERVER['BASE_PAGE']}">show source</a> |

« previous php.mirrors (#20558) next »