This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Install & configuration » How can I do loops in templates?

How can I do loops in templates?

How can I do loops in templates?

Saturday 25 January 2003 7:24:06 am

I've created a calendar and I've separated logic from presentation, so I receive a multidimensional array. Each item is a week wich is again an array with seven items (one for each day). Each day item is an array with two items: the day number and the object id. I want use this object id for a URI like {concat('content/full', $objectId)|ezurl}.

I try a loop in template but print nothing. Furthermore, I don't know create and manipulate variables and loops in "template language" (documentation please).

I need translate the following php code to "template language".
Can help me?

$weeks = $Result['weeks'];
print "<table>";
foreach( $weeks as $week )
print "<tr>";
for ($i = 0; $i < 7; $i++)
$day = $week[$i][0];
$objectId = $week[$i][1];

// the following sentence is mixed php and template code
$dayLink = {concat('content/full/', $objectId)|ezurl)}

if ($objectId == false)
print "<td>$day</td>";
} else {
print "<td><a href=\"" . &dayLink ">\"$day</a></td>";
print "</tr>";
print "</table>";

Thanks in advance.
Adolfo Barragán

No reply yet!


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from