View Single Post
Old 11-22-2008, 09:12 PM   #10 (permalink)
Tanax
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

It's funny that you didn't even seem to care before, and now you want to know everything. If I wouldn't have posted that I solved it, noone could care less if I solved it, or not. But now that I did, I get 2 replies almost directly.

The issue(problem) was that I wanted to limit the number of results PER row. And if I placed the repeat in the td tag it would write alot of results on the same row. If I were instead to place the repeat in the tr tag, it would just write alot of results with only 1 result per row. I wanted to limit this so I could have for example 6 results per row.

The solution was to use array_chunk:
HTML Code:
		<table tal:condition="showImages" cellspacing="5px">
			
			<tbody>
			
				<tr tal:repeat="chunk php:array_chunk(images, 5)">
					<td tal:repeat="image chunk">
						<a href="view.php?image=${image/image_id}"><img src="${path}/${image/image_name}" border="0" /></a>
					</td>
				</tr>
				
			</tbody>
			
		</table>
__________________
Tanax is offline  
Reply With Quote