<html>
<body>
<h1>Alternating list example with: <a href ="http://www.templatetamer.com/">
TemplateTamer</a></h1>
<table width=256>
<!--NAME:ONEITEM -->
<!--NAME:WHITEROW -->
<tr bgcolor="white">
This is an white item number: {ITEMNUMBER}
</tr>
<!--END:WHITEROW -->
<!--NAME:BLUEROW -->
<tr bgcolor="cyan">
This is an blue item number: {ITEMNUMBER}
</tr>
<!--END:BLUEROW -->
<!--END:ONEITEM -->
</table>
</body>
</html>
Here is the logic code for the page:
<?PHP
// Logic code for the TemplateTamer page: REPEATED_TEMPLATE
class alternating_list_Page extends TemplateTamer_Page {
function alternatingRows($n=10) {
//this creates an array with elements for each item to be displayed
//but this time we once include BLUEROW template, and next time WHITEROW,
//and the again BLUEROW, ...
for ($i=0;$i<$n;$i++) {
if ($itemKey == 'BLUEROW')
$itemKey = 'WHITEROW';
else
$itemKey = 'BLUEROW';