Loop De Loop
Loop De Loop
This month I thought I'd take a look at one of the more common template variables available to nearly all assets in WebGUI, the Loop. I'm sure that most folks who have templated in WebGUI know what a loop is, but there a couple of things that can be done with them that maybe you never considered.
Re: Loop De Loop·
Hey Steve, Great to see the design squid posts flowing regularly. Keep up the great work. One minor quibble, in the case of the attachment loop the true/false test is unnecessary because if the loop is empty the inner loop won't do anything. It's the equivalent of saying in perl: if (@attachment_loop) { When you really only need to say: foreach (@attachment_loop) { Cheers, Patrick
Re: Loop De Loop·
Alternatively you could get rid of the __FIRST__ and __LAST__ instead, leaving something like this: <tmpl_if attachment_loop>
Re: Loop De Loop·
You make a good point, pat. Because I used __FIRST__ and __LAST__ I wouldnt' have to have the loop test. Preaction's example is a better showcase of a solid reason to use that testing methodl. |

