Smarty
Posted: Tue Nov 06, 2007 11:57 pm
Do you guys recommend the Smarty template engine? I'm having a play.
I also have a questions... To output a table, you need to use this code:
Is there anyway to make it run something like this:
I need it like the above so that I can replace items within the template etc after it's been compiled..
For example, I need to include the template which is a full HTML file (it has the <html>, <head> and <body> tags) and I need to replace everything between the two <head> and </head> tags... I don't seem to be able to do that when it prints it directly on the page.
E.g:
Any ideas or is it not possible?
I also have a questions... To output a table, you need to use this code:
Code: Select all
$smarty->display("template.php");Code: Select all
$template = $smarty->display("template.php");For example, I need to include the template which is a full HTML file (it has the <html>, <head> and <body> tags) and I need to replace everything between the two <head> and </head> tags... I don't seem to be able to do that when it prints it directly on the page.
E.g:
Code: Select all
preg_match( "/\<head\>(.*?)\<\/head\>/is", $template, $head);
$template = str_replace($head[1], "<head>\n<style>".$style_sheet_code."</style>\n</head>", $template);