at the moment I'm working on a script, where I want to use templates. The templates are just a small portion of the script, therefore I don't wat to use a template engine, but insert a function into my script.

In my template I define different 'blocks' of code and based on teh output of the script, these bloacks must either be used or not.

The blocks are marked by [blockname] en [/blockname]. It is possible that there are muttiple blocks in the template and I can't tell in advance how many and what their names are. The thing that I want to do is, select the code that is within the blocks and put it into a variable thate contains the name of the block.

an example:




$tpl_blok1 = "<tr><td>{TITLE}</td></tr>";
$tpl_blok2 = "<tr><td>{MESSAGE}</td></tr>";

Now I'm wondering what is the best way to do this ... I can't seem to figure out how I can do this. Anyone have any suggestions?

Thanx in advance! -Michiel