list view more than one at a time

4 posts by 2 authors in: Forums > CMS Builder
Last Post: March 15, 2008   (RSS)

By Chris_t - March 14, 2008

Hello all, been doing pretty good in CMS but today I ran into a problem. I need to display 3 results per row. I tried just removing the <br> still they all listed in a row one wide.
I then created a table to house the 3 ( yes I know div tags are the new thing but I have been doing tables to long to give up on them). By placing the <?php foreach ($listRows as $record): ?> before the start of the table and <?php endforeach ?> at the end of the main table they do display 3 across like I want but each row is 3 of the same data. and when I move the ?php endforeach ?> or add more it just returns line errors. please help I am sure it is a simple problem.

Thanks
Chris

Re: [ChrisTitchenal] list view more than one at a time

By Dave - March 14, 2008

I think you might want something like this:

<table ... >
<tr>

<?php foreach ($listRows as $record): ?>
<td> ... display record ... </td>

<?php $maxCols=3; if (++$count % $maxCols == 0): ?>
</tr><tr>
<?php endif ?>

<?php endforeach ?>

</tr>
</table>


What that does is print each result in a cell and start a new row every 3 cells (columns).

If that's not it, can you post an url to your testpage and a mockup of what you want it to look like?

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [ChrisTitchenal] list view more than one at a time

By Dave - March 15, 2008

Nice site!

Are they still repeating 3 across? If so, and you want help with that, feel free to attach the playerList3.php and I can have a look at it for you.
Dave Edis - Senior Developer
interactivetools.com