Re: getStatic

From: Date: Tue, 25 Nov 2008 14:36:57 +0000
Subject: Re: getStatic
Groups: php.general 
Request: Send a blank email to php-general+get-283802@lists.php.net to get a copy of this message
str_replace will take arrays for "before" and "after" sequences. So, build arrays, and do ONE str_replace and Bob's your uncle. Another option, a bit crude, but effective, would be to wrap your template-y bit in a function that calls 'extract' on an array of variable names. class Template_thingie { private $vars = array(); public function template_register_variable($varname){ $vars[] = $varname; } function template_render_whatsit(){ extract($vars); include("some_file_$foo_here.php"); }

« previous php.general (#283802) next »