Re: dynamic html <head> info

From: Date: Mon, 19 May 2003 07:28:23 +0000
Subject: Re: dynamic html <head> info
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148138@lists.php.net to get a copy of this message
No. What I do instead, is have each seperate page include 'prepend.inc', and then define commonHeader() and commonFooter() functions in prepend.inc. prepend.inc :: <? function commonHeader($title){ ?> <html> <head> <title>My site :: <?=$title?></title> </head> <body> <? } function commonFooter(){ ?> </body> </html> <? } ?> index.php :: <? include 'prepend.inc'; commonHeader('Home'); ?> My content. <? commonFooter(); ?> Regards, Jasper Bryant-Greene Fatal Networks www.fatalnetwork.com Mvcs wrote:
Somewhat general variable usage question I guess. Thanks to anyone that has a few minutes to enlighten me. Say 'head.php' contains the html <head>title, meta, etc...</head> block of text, and 'content.php' has html content, and your index page looks like: <html> <head> <? require ("/usr/local/www/dubya.org/htdocs/common/head.php"); ?> </head> <body> <? require ("/usr/local/www/dubya.org/htdocs/common/content.php"); ?> </body> </html> Can you populate variables in 'head.php' from vars in 'content.php,' even though the head was included first? (and thus already processed?) eg. having <title><?php print $pagetitle; ?></title> in the head.php, and <? $pagetitle = "my page title"; ?> at the top of the 'content.php' file.


« previous php.general (#148138) next »