Merging records and displaying desired fields

4 posts by 2 authors in: Forums > CMS Builder
Last Post: July 26, 2011   (RSS)

Re: [Tim_cmsb] Merging records and displaying desired fields

By Jason - July 22, 2011

Hi Tim,

If you just want to skip records that don't have any images you could use this:

<?php shuffle($TimMergeRecords); $count=0; foreach ($TimMergeRecords as $recordMerge): ?>
<?php if (!$recordMerge['imagen']) { continue; } ?>


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] Merging records and displaying desired fields

By Tim_cmsb - July 22, 2011

Jason,

I'm still getting the empty spaces...!
I'm working with columns!!!
And the shuffle is not going through all the records.

Regards,

Tim

Re: [Tim_cmsb] Merging records and displaying desired fields

By Jason - July 26, 2011

Hi Tim,

I took a look at the page and it seems like the shuffle is working, since the order of the records change as you refresh the browser. Here are some changes you can try.

First, remove this line:
$TimMergeRecords = array_slice($TimMerge, 0, 12);

We can control the number of records being output using a counter.

Then, make these changes:

<?php $maxCount = 6; ?>
<?php shuffle($TimMerge); $count=0; foreach ($TimMerge as $recordMerge): ?>
<?php if (!$recordMerge['imagen']) { continue; } ?>
<?php if ($count == $maxCount) { break; } ?>
<?php $count++ ;?>


Finally, change the code that controls the columns like this:

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

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/