Including files for templates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm trying to write a template system, my template is the HTML layout, and my content is fetched from another source. However I don't quite understand how to output the template so that all the variables are parsed by PHP. Simple version of what I'm trying to do;

ob_start( );

extract( $params, EXTR_PREFIX_SAME, "am_");

$pageContent = file_get_contents( "page_to_display.html");

include( "template.html");

echo ob_get_clean( );


$pageTitle is in the template, it's replaced, $pageContent is in the template, it's replaced. But any variables within the page_to_display are simply output into the page rather than processed by PHP. I realise that file_get_contents is basically returning a string and I"m just doing string replacement when I include the template.html, so my only question is, what's the actual way of doing this?

Thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux