On Sat, November 5, 2005 1:10 pm, Leonard Burton wrote:
> Greetings,
>
> HI All, I hope all is well.
>
> I have set up a template parser.  Basically, it parses the template
> and finds tags with tag_name.dat file and then includes the
> tag_name.dat file.  I have considered a few other options but as of
> now I think I like what I have come up with.
>
> The only problem that I have in my design is that I have to hard code
> tables in the dat file mixing php and html.  I would prefer to be able
> to do something like:
>
> [[tag with db query]]
> <table>
> <tr><td>colname</td><td>colname</td><td>colname</td></tr>
> <tr><td>%var1%</td><Td>%var2%</td><td>%var3%</td></tr>

Perhaps this:
%%repeat%%<tr><td>%var1%</td><td>%var2%</td><td>%var3%</td></tr>%%repeat%%

> </table>
> [[/tag with db query]]
>
> I would like it to be able to parse the line with the %var1% (which is
> the column name with % or some other indicator on each side) in it and
> then have it generate how many ever rows as nessecary.
>
> Currently, my parsing engine loads the template, preg_splits() it so
> each template tag is on a new line, and then passes through the
> resulting array and executes the code for whatever tag is chosen.
>
> There are a couple ideas that I have thought of but have not thought
> of any real good way so I am turning to the list.

[waving hands wildly]
Then you could maybe use some kind of callback / back-reference
thingie in that preg_ thingie...  yeah, okay, so that part I'm not
real clear on. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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

Reply via email to