|There's more than one way to do things|
Re: Calling functions in middle of CGI HTML declarationsby Don Coyote (Pilgrim)
|on Aug 26, 2012 at 15:04 UTC||Need Help??|
Another way would be to place the array as an argument to the div method directly. You can get different results from slightly different constructs. Please note I am using the object orientated syntax. I have updated this reply with the syntax for the method orientated syntax. See end of post.
Placing the array directly as an argument will result in the list being expanded as content.
To reproduce a singular div for every item in the list then let the method know you are supplying a list by placing square brackets around the array.
Using a foreach loop may become necessary if you perhaps wanted the id of each div to be entitled as per each item of the array. But while in the first two instances you would be placing the array into the content compartment of the argument to div, this would be a standalone statement for cgi to process. That is, placed outside of any arguments to div, if you wanted to you could write a quick div method to wrap any arrays of divs.
Have a play around with those and you should be able to get what you want.
Update UTC 19:55 27 08 2012
I have revisited my reply to adjust for using the method calling approach. Most of the previous works by simply removing the $q calls. However to enable the final foreach statement to work you will also need to import the div element methods as well as :standard.
This allows you to use start_div and end_div methods. The glob in front of element allows you to call any start_element, end_element pair from your script. I have also included the reference syntax as shown by Your Mother in reply