Bit of a complicated one this:
My script has a lot of includes throughout, mainly so that the structure stays as flexible and customizable as possible. To do this, I hold certain structure-related HTML code in seperate files and then use bangs (eg <!head>, <!footer>, etc) to indicate where they should be included.
When the script reaches the end, I have an output callback function which runs through the code and replaces the bangs with HTML like so:
function bangs($buffer){
global $final_render_time, $week;
$head=file_get_contents('inc/head.php');
$masthead=file_get_contents('inc/masthead.php');
$lcstart=file_get_contents('inc/lcstart.php');
$lcend=file_get_contents('inc/lcend.php');
$rcstart=file_get_contents('inc/rcstart.php');
$rcend=file_get_contents('inc/rcend.php');
$ccstart=file_get_contents('inc/ccstart.php');
$ccend=file_get_contents('inc/ccend.php');
$bottom=file_get_contents('inc/bottom.php');
$yr=date('Y');
$find=array("<!head>", "<!masthead>", "<!lcstart>", "<!lcend>", "<!ccstart>", "<!ccend>", "<!rcstart>", "<!rcend>", "<!bottom>", "<!skin>");
$replace=array($head, $masthead, $lcstart, $lcend, $ccstart, $ccend, $rcstart, $rcend, $bottom, "17");
$buffer=str_replace($find, $replace, $buffer);
return $buffer;
}
The problem comes where I try to use PHP in these included files - it just doesn't work! I've tried many things, like throwing eval() functions around and hoping something works, but so far I've had no luck.
Any suggestions? Please?!