Search found 4 matches

by Martin Strand
Sat Dec 04, 2004 1:00 am
Forum: PHP - Code
Topic: Evaluating variables in included file
Replies: 7
Views: 552

Mostly cause the templates will be edited by a very limited htmlarea-like editor and I wanna keep them as simple as possible. Perhaps I'll go with some kind of string replace anyway, I'm not sure yet. Speed is not an issue since this script simply outputs an html file when the content changes, inste...
by Martin Strand
Sat Dec 04, 2004 12:14 am
Forum: PHP - Code
Topic: Evaluating variables in included file
Replies: 7
Views: 552

Thanks, but the thing is that I don't want any php code in the template file.
by Martin Strand
Fri Dec 03, 2004 11:39 pm
Forum: PHP - Code
Topic: Evaluating variables in included file
Replies: 7
Views: 552

Ok, I did this:

Code: Select all

$page = "print <<< END_OF_TEMPLATE\n" . file_get_contents("template.html") . "\nEND_OF_TEMPLATE;\n";
eval($page);
Perhaps there's a better solution?
by Martin Strand
Fri Dec 03, 2004 11:00 pm
Forum: PHP - Code
Topic: Evaluating variables in included file
Replies: 7
Views: 552

Evaluating variables in included file

Hi all. I want a very basic template system where the templates look like this: &lt;h1&gt;{$header}&lt;/h1&gt; &lt;p&gt;{$paragraph}&lt;/p&gt; and the php code: &lt;?php $header = "Headline"; $paragraph = "content, content, content"; // Here, s...