Re: [htmltmpl] loop counting
Brought to you by:
samtregar
From: Mathew R. <mat...@ne...> - 2007-04-30 23:51:28
|
sure thing - but it does require using H::T::Expr. I use the following snippet as-is to a gallery of photo's. Notice the use of modulo (%). Mathew <table width=100% border=0 cellpadding=1 cellspacing=1> <TMPL_LOOP gallery> <TMPL_IF EXPR="(__counter__ % 3) == 1"> <tr valign=top> </TMPL_IF> <td width=33% align=center valign=top class=text> <a href="<TMPL_VAR paths.gallery>/<TMPL_VAR NAME=filename ESCAPE=URL>" title="Click to enlarge"><img alt="" src="<TMPL_VAR paths.thumbnail>/<TMPL_VAR NAME=filename ESCAPE=URL>" width=180 height=200 border=0></a><br> <<TMPL_VAR spacer> width=10 height=6><br> <TMPL_VAR NAME=description ESCAPE=TEXT> </td> <TMPL_IF EXPR="(__counter__ % 3) == 0"> </tr> <tr> <td colspan=3> <<TMPL_VAR spacer> height=18 width=100%> </td> </tr> </TMPL_IF> </TMPL_LOOP> </table> Michael Greenish wrote: > Hello, > > I have a series of images that I would like to output but I want to limit it to only 4 images per row. I would like to put a br tag to force the 5th, 9th, etc... image to go to the next row. Can I do this completely int the template using an iterator or resettable counter? > > Thanks, > > greanie > > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |