Two logos on each row?

4 posts by 2 authors in: Forums > CMS Builder
Last Post: October 6, 2009   (RSS)

I need help for a good looking presentation of some logos.

What I would like to do, is uploading small logos (each with a link, so people, with a mouseclick on the logo, can go to a homepage).

All the logos then should be seen in a table with two coloumns but as many rows as needed, so there always will be two logos on each row, like this: Logo 1 and 2 on the first row, logo 3 and 4 on the second row, logo 5 and 6 on the third row and so on.

Also, if I want to delete logo 3, then logo 4 and 5 should be on the second row.

How can I do this with CMS Builder?

Re: [einslistir] Two logos on each row?

By Chris - September 25, 2009 - edited: September 25, 2009

Hi einslistir,

You certainly can! I think the simplest approach would be to use code like this to output your logos in two columns:

<table>
<tr>
<?php foreach ($blogRecords as $record): ?>
<td>
<?php echo $record['name'] ?>
</td>
<?php $maxCols=2; if (@++$count % $maxCols == 0): ?>
</tr><tr>
<?php endif ?>
<?php endforeach ?>
</tr>
</table>


Note that you'll want to replace the code in red with your own details.

I hope this helps. Please let me know if you have any questions.
All the best,
Chris

Re: [chris] Two logos on each row?

Thank you very much! It works perfectly!

If I want to change the coloumns from 2 to 3 or 4, then I guess, I just have to change to number in this part of the code?

$maxCols=2;