Re: [SMARTY-DEV] Newbie Coding Question
| From: | andreas halter | Date: | Fri, 21 Feb 2003 07:06:50 +0000 |
| Subject: | Re: [SMARTY-DEV] Newbie Coding Question | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-792@lists.php.net to get a copy of this message | ||
Eric Hilding told me on Friday 21 February 2003 06:46:
> This is some PHP code to display alternating color rows for output
> for 3 fields. I would appreciate it greatly if anyone could help me
> (us) see how the .php and .tpl files should look which will be a
> great learning tool (and for practical use but with many more
> fields).
hmm
1. write html tags lowercase
2. script.php [untested]
<?php
$o=new Smarty;
$o->assign('ROWS',$array_with_rows_collection);
$o->display('templ.tpl');
?>
3. templ.tpl [untested]
<table>
{section name=item loop=$ROWS}
<tr>
<td {if (%item.rownum% % 2) == 0} class="alt" {/if}>
{$ROWS.item.value}
</td>
</tr>
{/section}
</table>
but there's a bunch of other ways to do so, have a look at the doc.
--
www.andreashalter.ch
futurama: 'file deletion is murder!'