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 Chris - January 3, 2011

Hi Maurice,

Does this do what you want?

<?php

// load records

list($fooRecords,) = getRecords(array(
'tableName' => 'foo',
));
list($barRecords,) = getRecords(array(
'tableName' => 'bar',
));
list($baazRecords,) = getRecords(array(
'tableName' => 'baaz',
));

?>

<h1>Section: Foo</h1>
<?php foreach($fooRecords as $record): ?>
<h2>Record: <?php echo $record['num'] ?></h2>
<?php foreach($record['upload'] as $upload): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>
<?php endforeach ?>
<?php endforeach ?>

<h1>Section: Bar</h1>
<?php foreach($barRecords as $record): ?>
<h2>Record: <?php echo $record['num'] ?></h2>
<?php foreach($record['upload'] as $upload): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>
<?php endforeach ?>
<?php endforeach ?>

<h1>Section: Baaz</h1>
<?php foreach($baazRecords as $record): ?>
<h2>Record: <?php echo $record['num'] ?></h2>
<?php foreach($record['upload'] as $upload): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>
<?php endforeach ?>
<?php endforeach ?>

All the best,
Chris

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