Re: set var in PHP clarified

From: Date: Thu, 19 Jul 2001 07:00:07 +0000
Subject: Re: set var in PHP clarified
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-58620@lists.php.net to get a copy of this message
Jessica, I used that technique before PHP was available (for all readers, the key term here is Server Side Includes, e.g. http://httpd.apache.org/docs/howto/ssi.html.html). With PHP you're a lot more flexible so that you should get rid of your shtml structure, especially as PHP is much faster what really makes a difference if you've got many includes. For this simple example, the syntax is quite similar. In your main document, simply type: <?PHP $title="some title"; include("/include/header.html"); ?> and in the header.html: <title><?PHP echo $title; ?></title> That's it. But remember to either set *.html files to be parsed through PHP in your web server configuration or rename the main document to .php (or .php3 or .php4 or whatever your web server needs). >Thanks for the prompt replies...but I think I should clarify... > >In regular html, I would do this: > ><!--#set var="TITLE" value="some title here"--> ><!--#include virtual="/include/header.html" --> > >and header.html would have in it (among other things): > ><title><!--#echo var="TITLE" --></title> > >So, the title of the webpage would be "some title here"... > >How can I accomplish the same thing in PHP? mit freundlichen Gruessen / yours sincerely Gunther E. Biernat Web Application Engineer ______________________________________________________________ RealNetworks GmbH Tel.: +49-40-415204-24 Weidestraße 128 Fax.: +49-40-415204-11 22083 Hamburg Mail: GEBiernat@real.com Germany URL : http://de.real.com ______________________________________________________________

« previous php.general (#58620) next »