Forums / Setup & design / loop the object / Comment17184
Tobias Persson
Monday 27 December 2004 10:02:57 am
Opps. I forgot a 'show' in the section. I also moved some variables into the 'let' . Remember to change the p_node_id to the correct value.
Here is the more correct code:
{let loops=6 countitems=0 p_node_id=93} <table> {section loop=fetch('content','list', hash('parent_node_id',$p_node_id, limit, $loops))} {set countitems=fetch('content','list_count', hash('parent_node_id',$p_node_id))} <tr> <td bgcolor=red> {$:item.name} </td> </tr> {/section} </table> {set loops=$loops|sub($countitems)} {section show=$loops|gt(0)} <table> {section name=loop loop=$loops} <tr> <td bgcolor= red> try it even without fetching to any data from the content </td> </tr> {/section} </table> {/section} {/let}