varinder-kudosweb
-
7/7/2011 4:34:45 AM
'For loop' for image gallery
Hi all, heres the situation: i was working on a project which shows a list of products (repeater) in a nice style (transformation) and details about a product can be seen by clicking it (selected transformatiom).
now in the products details page (selected transformation) there is a small light-box image gallery which shows pictures of the product (so far so good) but the problem is back-end, on the back-end, client is given 12 image upload input-boxes (which isnt really a user friendly option). Then on the products details page (selected transformation) theres a repeater which checks all those 12 fields for that product and spits out appropreate lightbox code for all the fields which were not empty but the way this repeater's transformation code was written (which really takes the point of having a repeater off the table). was something like (not on my computer so hardly remember what the exact code was)..
<%# ifEmpty(eval("image1"), "", <a href=.....) #> <br/> <%# ifEmpty(eval("image2"), "", <a href=...)#> <br/> ......... so on to image12.
it works but it really got me wondering if theres any other approach. i mean, is it possible to create some kind of for loop which goes throught all those fields and shows gallery?
something like for i=1 to 12 do ( ifempty(eval("image". i), "" .....) ) (excuse my messed up programming knowledge)
hope it makes sense :)
|