You are here: Re: Template style question « PHP « IT news, forums, messages
Re: Template style question

Posted by GamblerZG on 11/06/05 01:41

Leonard Burton wrote:
> [[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.

Why don't you use PHP itself?

//db query
?>
<table>
<tr><td>colname</td><td>colname</td><td>colname</td></tr>
<?php
foreach ($row = query($result)) {
echo
"<tr><td>$row[var1]</td><Td>$row[var2]</td><td>$row[var3]</td></tr>";
}
?>
</table>
<?php
db query


--
Best regards,
Roman S.I.

http://sf.net/projects/naturalgine/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация