3 coloumns listing + some more...

By Jason - July 27, 2010

Hi,

I think it may have to do with the script. The id for the div is supposed to be the filename, not the file path.

Try changing it to this:
<div id="<?php echo $upload['filename'];?>" class="gallery_image">

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] 3 coloumns listing + some more...

By mingyq - July 27, 2010

Scratching my head, nope this didn't help either, any other suggestions? Would it help if I gave you the FTP login?

MingyQ

By Jason - July 28, 2010

Sure, email it to jason@interactivetools.com and I'll take a look.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By Jason - July 29, 2010

Hi,

I took a look at the code, and it looks like in your Gallery.php page, your selecting information from a table that contains youtube links. This information is used to create flash objects. This is not happening in your gallery_test3.php page.

Because this is dealing with a third party script, it's a little more involved than what we deal with in the forum. We would be more than happy to look into this issue further through our consulting service:
www.interactivetools.com/hire-us/


Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Rusty] 3 coloumns listing + some more...

By Rusty - February 17, 2011

One other thing When working with a List Page, how can you go about incorporating CMS FOREACH to set it up to make let's say a 3x3 grid, 3 rows of 3. Obviously some kind of counter would be necessary, to increment for each of the 9 records, and we can use the above code to force it to a new row...
Rusty

Re: [Rusty] 3 coloumns listing + some more...

By Jason - February 17, 2011

Hi Rusty,

"%" is the modulus operator in PHP, which means it returns the remainder of the the left hand side divided by the right hand side.

What this is doing is looking for multiples of 3. So every time $count is a multiple of 3, the answer will be 0:
ie
3 % 3 = 0
6 % 3 = 0
9 % 3 = 0
etc

This is a good way of handling it if you don't know how many records you'll actually be dealing with.


As for using a foreach to create a grid of 3 x 3, you could do something similar to this example:


<?php

$maxRows = 3;
$maxCols = 3;

$colCount = 0;
$rowCount = 1;

?>

<?php foreach ($productRecords as $record): ?>

<?php if($rowCount < $maxRows){ break;} ?>

<?php if (++$colCount % $maxCols == 0): ?>
<div class="plan_box last">
<?php $rowCount++ ;?>

<?php else: ?>
<div class="one_third">

<?php endif; ?>

<?php echo $record['title'];?>

</div>

<?php endforeach ?>


Hope this helps get you started.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/