I'm trying to get my preg_replace to execute an include:
This code prints a list of the files i want executed...
function replaceCommonTemplates($template) {
$search = '/\<common_template=\"(.*?)\"\>/' ;
$replace = '$1.php' ;
$template = preg_replace($search, $replace, $template) ;
return $template ;
Output:
Content-type: text/html
X-Powered-By: PHP/4.3.10
Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
header.php
navigation.php
form_start.php
text_field.php
password_field.php
submit.php
form_end.php
footer.php
Then I modify it to this:
function replaceCommonTemplates($template) {
$search = '/\<common_template=\"(.*?)\"\>/' ;
$replace = '$1.php' ;
$template = preg_replace($search, include(SKIN_PATH."common_template/$replace"), $template) ;
return $template ;
}
but get:
Debug session started.
Debug Warning: C:\Files\core\lib\skin.php line 42 - replacecommontemplates(C:/Files/skin/common_template/$1.php): failed to open stream: No such file or directory
Debug Warning: C:/Files\core\lib\skin.php line 42 - replacecommontemplates(): Failed opening 'C:/Files/skin/common_template/$1.php' for inclusion (include_path='.;c:\php4\pear')
Debug session ended.
$1 - seems like its not converting the $1 to its name like above?
Thanks for any help...