multi section images on 1 homepage

6 posts by 3 authors in: Forums > CMS Builder
Last Post: January 4, 2011   (RSS)

By Maurice - January 2, 2011

Hi all,

i have a few sections like news, blog and events

on a home page i want to place images from all those sections the content is oke but the upload code is the same for all images.

how can i display the images from different sections on 1 page?

Thnx
-------------------------------------------

Dropmonkey.nl

Re: [Maurice] multi section images on 1 homepage

By Jason - January 3, 2011

Hi Maurice,

The most straight forward way to do this would be to use getRecords to select from these different sections and then output the images from whichever records you want.

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] multi section images on 1 homepage

By Maurice - January 3, 2011

cool do u have an example?
-------------------------------------------

Dropmonkey.nl

Re: [Maurice] multi section images on 1 homepage

By Jason - January 3, 2011

Hi,

For example, if we wanted to use a section called news and a section called articles, it would work like this:

I'm assuming that the name of the image field in both sections is called images:



<?php
list($newsRecords,$newsMetaData)=getRecords(array(
'tableName' => 'news',
'allowSearch' => false,
));

list($articleRecords,$articleMetaData)=getRecords(array(
'tableName' => 'articles',
'allowSearch' => false,
));

$imageRecords = array_merge(array_pluck($newsRecords,'images'),array_pluck($articleRecords,'images'));
$imagesRecords=array_filter($imageRecords);
?>

<?php foreach($imageRecords as $imageRecord):?>
<?php foreach($imageRecord as $image):?>
**OUTPUT IMAGE HERE**
<?php endforeach ?>
<?php endforeach ?>



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] multi section images on 1 homepage

By Maurice - January 4, 2011

wauw you guy's are the best thanx allot.

Maurice
-------------------------------------------

Dropmonkey.nl