Looping Products in div not table

4 posts by 2 authors in: Forums > CMS Builder
Last Post: June 2, 2011   (RSS)

By dccreatives - June 1, 2011

I have a news page where I loop my news articles in tables using the php code

<table width="100%" align="left" cellpadding="2" cellspacing="2" class="table-news-bord">
<tr><?php $index=1; ?> <?php foreach ($newsRecords as $record): ?>
<td width="391" align="left" valign="top">

</td>

<?php $maxCols=2; if (@++$count % $maxCols == 0): ?> </tr><tr> <?php endif ?> <?php $index++; ?>
<?php endforeach ?>
</tr>
</table>

(I am looping a spry script, so I added the <?php $index++; ?> )

Please check out this page: http://www.axislighting.com/CMS/newsList.php Since I am using collapsible panels with Spry, when you open the article on the top right, by clicking read more link, it pushes down the article on the top left as well and it looks funny. I understand that this is happening because they are in the same <tr> so when you extend one, the other gets extended.

I am assuming that if I use the <div> tag this might not happen.

Any suggestions how and if this can be done?

Re: [dccreatives] Looping Products in div not table

By Toledoh - June 1, 2011

If you put each block into a div, and float them left or right it will work better. But even then, when you open the spry, it's still going to shuffle items and look a bit messy (IMHO).

You may want to fix the divs some way, then float the expanded text over the other items? Kinda like http://www.sohtanaka.com/web-design/popout-details-on-hover-w-css/

Good luck.
Cheers,

Tim (toledoh.com.au)

Re: [dccreatives] Looping Products in div not table

By Toledoh - June 2, 2011

By looping, do you mean in thr grid format? If so, if the divs are contained within a set width, and the divs themselves have a set width, floating them will automatically lay them out.
Cheers,

Tim (toledoh.com.au)