Displaying in rows of 2 Is this possible?

5 posts by 2 authors in: Forums > CMS Builder
Last Post: August 25, 2008   (RSS)

Re: [proweb] Displaying in rows of 2 Is this possible?

By Dave - August 25, 2008

Hi proweb,

Just to clarify before I answer - do you mean in the admin program or when you display the content on the website?

Let me know.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Displaying in rows of 2 Is this possible?

By proweb - August 25, 2008

Hi Dave,

Sorry, I meant the 'final' content on the website

Many Thanks,

David

Re: [proweb] Displaying in rows of 2 Is this possible?

By Dave - August 25, 2008

Hi David,

Ok, yes, you can do that.

The first step is to create a mockup of how you want it to look.

Next, there are a few ways to do it. A pure CSS way is to put each "entry" in a div and left float them inside a larger container.

A PHP way is to create a table, keep track of which "entry" we're on and insert a closing/opening row tag every 3 rows - like this: (replace $yourRecords and title with the names from your viewer code).

<table border="1">
<?php foreach ($yourRecords as $record): ?>

<td><?php echo $record['title'] ?></td>

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

<?php endforeach; ?>
</table>


If you're not sure where to begin start with the mockup of how you want it to look. And feel free to post any questions back to this thread.

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

Re: [Dave] Displaying in rows of 2 Is this possible?

By proweb - August 25, 2008

Thank you Dave, this helps alot