Sriram Thodla
|
Posted: 03/04/2003, 10:05 AM |
|
Hello all,
I like code charge's templating mechanism but find it a bit confusing
on how to use the nested templates.
Heres' what I need.
I am trying to display a grid where a program grid where the cols are track
name and rows are time blocks
Here' what I would like to display
1 2 3
9-10 Session A Session B Session C
10-11 Session D
11-12 Session E
Now here's the current template block set up I am using
<!-- BeginTrackBlock -->
{SesTime}
<!--BeginSessionBlock-->
<td>{SesName}</td
<!--EndSessionBlock-->
<!--EndTrackBlock-->
In the php, I use a nested for loop to loop through each time block,and then
trhough each track to see if it has any sessions for that time.
for every time block
for every track
for each session
if session occurs at this time block, print this session
$tpl->parse("SessionBlock",true);
}
}
$tpl->parse("TimeBlock",true);
}
No the output is where it goes awry.. Here' what I get
1 2 3
9-10 Session A Session B Session C
10-11 Session A Session B Session C
Session D
11-12 Session A Session B Session C
Session D Session E
As you can see, the entire session block gets accumulated. Setting the
parameter to false ($tpl->parse(SessionBlock,false) meant that each block
gets overwriiteten and all i get is
1 2 3
9-10 Session C
10-11 Session D
11-12 Session E
I thought of not using session blocks itself but rather introduce a dynanmic
var call RowSTarter and RowEnder that when at the begging and at the end of
the loop, print <tr> and </tr> to force a new row. Howevver, this does not
seeme elegant
<!--BeginSessionBlock-->
{RowStarter}
{SesTime}
<td>{SesName}</td>
{RowEnder}
<!--EndSessionBlock-->
Can anyone help suggest a solution using nested template blocks?
|
|
|
|