?foru
10-15-2008, 04:47 AM
I've figured out another way to add modules to a CMS system, but I would like to have the possibility of adding additonal features to the template system such as included files.
The physical "theme.php" page uses <% main %> and the index page builds the template like this.
$template = eregi_replace("<% main %>", "$main", $template);
I would like to be able to turn $main into an included file, and I searched and found the following...
<?php
ob_start(); # start buffer
include_once( 'path/to/included/file/file.php' );
# we pass the output to a variable
$main = ob_get_contents();
ob_end_clean(); # end buffer
# and here's our variable filled up with the html
echo $main;
//....code to start to prepare the template
$template = eregi_replace("<% main %>", "$main", $template);
//...code to finish the template
?>
The issue is that I can't use echo $main; like above because it prints out at that exact position above the template. Anyone have an idea on how I can turn the $main variable in the eregi_replace string into the included page so <% main %> in the "template" file is replaced with the included file?
Thank you
The physical "theme.php" page uses <% main %> and the index page builds the template like this.
$template = eregi_replace("<% main %>", "$main", $template);
I would like to be able to turn $main into an included file, and I searched and found the following...
<?php
ob_start(); # start buffer
include_once( 'path/to/included/file/file.php' );
# we pass the output to a variable
$main = ob_get_contents();
ob_end_clean(); # end buffer
# and here's our variable filled up with the html
echo $main;
//....code to start to prepare the template
$template = eregi_replace("<% main %>", "$main", $template);
//...code to finish the template
?>
The issue is that I can't use echo $main; like above because it prints out at that exact position above the template. Anyone have an idea on how I can turn the $main variable in the eregi_replace string into the included page so <% main %> in the "template" file is replaced with the included file?
Thank you