471,887 Members | 1,357 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,887 software developers and data experts.

I'm looking for a simple template with "optional" fields

I'm looking for a simple template with the following property: I want
to have in the resulting page something like this (say):

This is some text that never changes:
[[[$this is some variable that can be set from the calling PHP
This is some more text that never changes

The crux is that if the calling code never initializes the variable,
then I want the entire <divnot to be displayed.

The use-case that I see is this: I have a program that mostly needs to
display long(ish) lists to the clients, but the lists can be
customized. Sometime I want to display the first five columns for each
row, sometime the last four columns, other times only the odd-numbered
columns, etc.

What I want, is to have only the following in my PHP code:

$qry = "SELECT [[[whatever fields I'm interested in]]] FROM mytable
$res = db_query($qry);
while ($row = db_fetch_assoc($res)) {

In the template I will have something like this:


and only the <td>'s whose column is actually included in $row will be

It seems quite trivial to write such a template (I really don't need
much logic there at all), probably a week worth of work. But it will
be even better if I can just use something out there instead.


-- Shai
Jan 18 '08 #1
0 1064

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Steve | last post: by
6 posts views Thread by .rhavin grobert | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.