Hi,
I have created a script that opens a template in order to show thepage, and used str_replace to "dynamically" update the elements, similar to this:
http://www.namepros.com/code/189417-php-template-system-php4-5-a.html
Although one of the things I want to do is:
replace whever it says {CONTENT} with
Which i can do, although then the PHP code just shows up on the page, so it seems like it needs to be parsed (right word?) again, and I can't fund any functions to do that, is there any way for thisto be done?
Here is the PHP code:
Thanks, Lee
I have created a script that opens a template in order to show thepage, and used str_replace to "dynamically" update the elements, similar to this:
http://www.namepros.com/code/189417-php-template-system-php4-5-a.html
Although one of the things I want to do is:
replace whever it says {CONTENT} with
PHP:
<?php include($page); ?>
Here is the PHP code:
PHP:
<?php
//open the configuration file
include('config.php');
//open the functions file
include('functions/functions.php');
//page variables
$page="index.php";
?>
<?php
//open the page template
$template=getconf('template');
$template='template/'.$template.'/index.htm';
$handle=fopen($template,'r');
$display_template=fread($handle,filesize($template));
fclose($handle);
//prepare image and css links for viewing
$display_template=str_replace('elements/','template/'.getconf('template').'/elements/',$display_template);
//prepare all other template features
$display_template=str_replace('{PAGE_TITLE}',getconf('page_title'),$display_template);
$display_template=str_replace('{FOOTER}',getconf('footer'),$display_template);
$display_template=str_replace('{HEADER}',getconf('header'),$display_template);
$display_template=str_replace('{CONTENT}',$page,$display_template);
echo $display_template;
?>
Thanks, Lee






