|
Posted by James Benson on 11/05/05 21:55
Give smarty a try rather than re-inventing the wheel
http://smarty.php.net
James
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>
> </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.
>
> Thanks for all of your help on this list!
>
> --
> Leonard Burton, N9URK
> leonardburton@gmail.com
>
>
> "The prolonged evacuation would have dramatically affected the
> survivability of the occupants."
[Back to original message]
|