cvs: phpweb /include layout.inc

From: Date: Tue, 20 May 2003 21:45:24 +0000
Subject: cvs: phpweb /include layout.inc
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-17863@lists.php.net to get a copy of this message
sas Tue May 20 17:45:24 2003 EDT Modified files: /phpweb/include layout.inc Log: Refactor code, use static.php.net and load style.css, favicon.ico, and userprefs.js from there. For the latter, cookies need to be set to "domain = .php.net"! Index: phpweb/include/layout.inc diff -u phpweb/include/layout.inc:1.155 phpweb/include/layout.inc:1.156 --- phpweb/include/layout.inc:1.155 Sat May 17 05:16:21 2003 +++ phpweb/include/layout.inc Tue May 20 17:45:24 2003 @@ -1,19 +1,17 @@ <?php -/* $Id: layout.inc,v 1.155 2003/05/17 09:16:21 goba Exp $ */ +/* $Id: layout.inc,v 1.156 2003/05/20 21:45:24 sas Exp $ */ + +$www_static_root = ($HTTP_SERVER_VARS['SERVER_NAME'] == 'www.php.net') ? 'http://static.php.net/www.php.net' : ''; +} // Print an image for a sized spacer function spacer($width = 1, $height = 1, $return = false, $align = false, $extras = false) { - global $HTTP_SERVER_VARS; - static $image_root = null; - - if ($image_root === null) { - $image_root = ($HTTP_SERVER_VARS['SERVER_NAME'] == 'www.php.net') ? 'http://64.246.30.196/www.php.net' : ''; - } + global $HTTP_SERVER_VARS, $www_static_root; $function = ($return ? "sprintf" : "printf"); return $function('<img src="%s/images/spacer.gif" width="%d" height="%d" border="0" alt="" %s%s />', - $image_root, + $www_static_root, $width, $height, ($align ? "align=\"$align\" " : ""), @@ -37,18 +35,13 @@ # function make_image($file, $alt=false, $align=false, $extras=false, $dir=false, $border=0) { - global $HTTP_SERVER_VARS; - static $image_root = null; - - if ($image_root === null) { - $image_root = ($HTTP_SERVER_VARS['SERVER_NAME'] == 'www.php.net') ? 'http://64.246.30.196/www.php.net' : ''; - } + global $HTTP_SERVER_VARS, $www_static_root; if (!$dir) { $dir = '/images'; } - $webdir = $image_root . ($dir{0} == '/' ? '' : '/') . $dir; + $webdir = $www_static_root . ($dir{0} == '/' ? '' : '/') . $dir; if ($size = @getimagesize($HTTP_SERVER_VARS['DOCUMENT_ROOT'].$dir.'/'.$file)) { $image = sprintf('<img src="%s/%s" border="%d" %s alt="%s" %s%s />', @@ -205,14 +198,15 @@ # function commonHeader($title="",$dont_enclose=0,$headers_gone=0) { - global $MYSITE, $base, $enclosed, $EXPL_LANG, $SIDEBAR_DATA, $SEARCH_BASE, $ONLOAD; + global $MYSITE, $base, $enclosed, $EXPL_LANG, $SIDEBAR_DATA, $SEARCH_BASE, $ONLOAD, $www_static_root; + ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>PHP<?php if ($title) echo ": $title";?></title> - <link rel="stylesheet" href="/style.css" /> - <link rel="shortcut icon" href="/favicon.ico" /> - <script language="Javascript" type="text/javascript" src="/userprefs.js"></script> + <link rel="stylesheet" href="$www_static_root/style.css" /> + <link rel="shortcut icon" href="$www_static_root/favicon.ico" /> + <script language="Javascript" type="text/javascript" src="$www_static_root/userprefs.js"></script> <?php echo (isset($SEARCH_BASE) ? '<base href="' . $SEARCH_BASE . '" />' : ''); ?> </head> <body bgcolor="#ffffff" text="#000000"

« previous php.mirrors (#17863) next »