Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-10-2004, 07:12 PM   PM User | #1
Michiel
Regular Coder

 
Join Date: Jul 2002
Location: The Netherlands
Posts: 252
Thanks: 0
Thanked 0 Times in 0 Posts
Michiel is an unknown quantity at this point
Selecting text-blocks from string

Hi,

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:

[block1]
<tr>
<td>{TITLE}</td>
</tr>
[/block1]

[block2]
<tr>
<td>{MESSAGE}</td>
</tr>
[block3]

result:

$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
Michiel is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:36 PM.


Advertisement
Log in to turn off these ads.