Products pages - "list" page results setup horizontally

27 posts by 4 authors in: Forums > CMS Builder
Last Post: October 21, 2008   (RSS)

By Dave - September 19, 2008

Ok, starting with the first page (photos2.htm) create a list of records with all the photos and fields you want displaying. Next, put them in a table like this (start with border=1 for debugging):

<table border="1">
<tr>

<?php foreach ($yourVariableName as $record): ?>
<td>
... insert code to show your fields and uploads here ...
</td>
<?php endforeach; ?>

</tr>
</table>


And that will show them all in a horizontal table.

Hope that helps, let me know how it goes.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Products pages - "list" page results setup horizontally

By james_jackson - September 26, 2008

Hi again, Dave!

I started dropping php code into the html mock up of that we've talked about & I'm getting some error messages. I wanted you to review them before I progress any further. There's obviously something I'm not understanding here...

I've uploaded photos & created a record with CMS Builder. Then changed the html mock up to a php file & added the code snippet about the header. Then I dropped in my Event Title & Event Description php code snippets.. This is what I've got:

Thanks again for all your time,
.james.

http://hamburgermarys-orlando.com/photos2.php

By Dave - September 26, 2008

No problem, can you attach the photos2.php file to this post?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Products pages - "list" page results setup horizontally

By james_jackson - September 26, 2008

There ya go... [:)]
Attachments:

photos2.php 12K

By Dave - September 29, 2008

Hi James,

I didn't see any errors in the attached file or on the page anymore?

What you want to do is start with the code from the code generator that displays images and then copy and paste the tags so they repeat that table cell in your code where you want the images to appear.

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

Re: [Dave] Products pages - "list" page results setup horizontally

By james_jackson - October 21, 2008

Hey again Dave!

Okay... I've got the main photos page functioning correctly & I'm ready to drop in the PHP snippet you noted above that will display my thumbnails in 3-column tr fashion. However, I'm confused about where to place the code: <?php $maxCols=3; if (@++$count % $maxCols == 0): ?></tr><tr><?php endif; ?> within my existing code.

Could you take a look and advise?

Thanks!

http://hamburgermarys-orlando.com/photos2.php

By Dave - October 21, 2008

Hi James,

First you want to put your images in a table. The code will look something like this (you'll need to fill in the gaps):

<table border="1" >
<tr>
<?php foreach ($uploads ... ?>
<td>
<?php ?>
</td>
<?php endforeach ?>
</tr>
</table>


So what that should do is create a new table cell for each image and make them stretch horizontally. Once that's working you add that code after the </td> but before the endforeach and it will insert a </tr><tr> ever 3 columns.

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