Finding template variables.

From: Date: Wed, 09 Aug 2000 15:55:35 +0000
Subject: Finding template variables.
Groups: php.general 
Request: Send a blank email to php-general+get-10950@lists.php.net to get a copy of this message
Greetings, Is there a way to retrieve a template variable (ie: %%title%%) and, if there's a string variable with the same name (ie: $title), substitute the template variable with the string value with "str_replace()"?? Ex: $header = file('header.inc'); while (list(,$value) = each($header)) { // RETRIEVE '%%...%%' VARIABLE FROM TEMPLATE $variable = [( PHP code to get variable from '$value' )]; // CODE TO CHECK FOR STRING WITH SAME NAME AS VALUE OF '$variable' // If '$variable' is '%%TITLE%%' then see if there is a '$title' // string and then set '$string = $title' $string = "$title"; // SUBSTITUTE '%%...%%' WITH STRING OF SAME NAME str_replace("$variable", "$string", "$value"); } If this is confusing, I'll try to clarify it a little more when I answer your replies. :o) TIA -- James Brown, Sr. CIO | DNS/System/Network Administrator Sys-Admin@CSUinternet.net | CSU internet, inc. - Tifton, GA.

« previous php.general (#10950) next »