cvs: phpweb /include layout.inc

From: Date: Fri, 15 Aug 2003 10:46:41 +0000
Subject: cvs: phpweb /include layout.inc
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-20359@lists.php.net to get a copy of this message
goba Fri Aug 15 06:46:41 2003 EDT Modified files: /phpweb/include layout.inc Log: Add the ability to specify that a page should not be indexed Index: phpweb/include/layout.inc diff -u phpweb/include/layout.inc:1.184 phpweb/include/layout.inc:1.185 --- phpweb/include/layout.inc:1.184 Thu Aug 14 09:32:37 2003 +++ phpweb/include/layout.inc Fri Aug 15 06:46:40 2003 @@ -1,5 +1,5 @@ <?php -/* $Id: layout.inc,v 1.184 2003/08/14 13:32:37 goba Exp $ */ +/* $Id: layout.inc,v 1.185 2003/08/15 10:46:40 goba Exp $ */ // Set the static content root differently on php.net $_SERVER['STATIC_ROOT'] = ($MYSITE == 'http://www.php.net/') ? @@ -55,6 +55,9 @@ // Default to empty array if improper parameter passed if (!is_array($config)) { $config = array(); } + // String defaults + $lang_input = $base = $meta = ''; + // Print out lang and charset headers if (!isset($config["lang"])) { $config["lang"] = "en"; } if (!isset($config["charset"])) { $config["charset"] = "ISO-8859-1"; } @@ -63,6 +66,11 @@ if (!empty($title)) { $title = ": $title"; } + // This page should not be indexed by robots + if (in_array("noindex", $config)) { + $meta .= "\n <meta name=\"robots\" content=\"noindex\" />"; + } + // Decide on onload event handler if (!isset($config['onload'])) { $config['onload'] = "searchHistory(); tocImages();"; @@ -71,12 +79,12 @@ // Explicit language setting means that we should put that into the form if (isset($EXPL_LANG)) { $lang_input = "\n <input type=\"hidden\" name=\"lang\" value=\"$EXPL_LANG\" />"; - } else { $lang_input = ''; } + } // Base href setting for URL shortcuts to work if (!empty($_SERVER['BASE_HREF'])) { $base = "\n <base href=\"{$_SERVER['BASE_HREF']}\" />"; - } else { $base = ''; } + } print <<<END_HEADER <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" @@ -86,7 +94,7 @@ <title>PHP{$title}</title> <style type="text/css">@import url("{$_SERVER['STATIC_ROOT']}/sitewide.css");</style> <link rel="shortcut icon" href="{$_SERVER['STATIC_ROOT']}/favicon.ico" /> - <script type="text/javascript" src="{$_SERVER['STATIC_ROOT']}/userprefs.js"></script>$base + <script type="text/javascript" src="{$_SERVER['STATIC_ROOT']}/userprefs.js"></script>$base$meta </head> <body onload="{$config['onload']}"> @@ -700,4 +708,4 @@ echo substr($links, 0, -2); } -/* vim: set noet ts=4 sw=4 ft=php: : */ +/* vim: set noet ts=4 sw=4 ft=php: : */ \ No newline at end of file

« previous php.mirrors (#20359) next »