Product listings
11 posts by 2 authors in: Forums > CMS Builder
Last Post: April 3, 2013 (RSS)
By gregThomas - April 3, 2013
Hi,
To fix the issue with products not displaying neatly on rows you just need to add a height to your newproduct3 class in your CSS, and probably set overflow to hidden.
To merge two arrays you should probably do something like this:
// load records from 'blog'
list($blogs, $blogMetaData) = getRecords(array(
'tableName' => 'blog',
'loadUploads' => true,
'allowSearch' => true,
));
// load records from 'news'
list($news, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'loadUploads' => true,
'allowSearch' => true,
));
$updates = array_merge($blogs,$news);
$updates = array_groupBy($updates, 'date');
?>
<ul>
<?php foreach($updates as $update): ?>
<li><?php echo $update['date']; ?></li>
<?php endforeach; ?>
</ul>
This is just example code, you'll need to implement this system into your own code.
So the array merge function will combine the two getRecords arrays together, then the array_groupBy function can be used to sort the merged array by a certain field. You need to make sure this field is in both of your sections. I've sorted by date Field so that all of my updates are from newest to oldest.
Let me know if you have any questions.
Thanks!
Greg
PHP Programmer - interactivetools.com