Re: Template style question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux