So could you do a nested loop that:

Steps through your images until they are are processed
foreach $num_of_cols (or remaining images if less) adds a value to an array 
(the new value being your td contents)
Adds blank cells if this row is only half full because the images are processed
echo $this->Html->tableCells( array( array( $your_td_array ) ) );

I haven't tried this, but it *might* work?

Jeremy Burns
[email protected]


On 15 May 2010, at 10:34, Ed Propsner wrote:

> $num_of_cols = 6; 
> 
> echo 
> $html->tag('table', null, array(
>                                         'cellspacing' => 0,
>                                         'cellpadding' => 5,
>                                         'border' => 0
>                                         )
>                  )
> .$html->tag('tr');
> 
> foreach($photos as $photo)
> {
> echo ($i!= 0 && $i%$num_of_cols == 0)?'</tr><tr>':'';
> echo $html->tag('td', null, array(
>                                             'valign' => 'top'
>                                            )
>                       )
> .$html->tag('a href="/photos/view/'.$photos[$j++]['Photo']['id'].'"')
> .$html->tag('img', null, array(
>                                         'src' => Router::url(array(
>                                                                              
> 'controller' => 'photos',
>                                                                              
> 'action' => 'displayPhotos/'.$photos[$k++]['Photo']['id']
>                                                                             )
>                                                                     ),
>                                                         'height' => 90
>                                        )
>                  )
> .$html->tag('/a')
> .$html->tag('/td');
> $i++; 
> }
> 
> echo $html->tag('/tr')
> .$html->tag('/table');

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to