combining two sections

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

Re: [rez] combining two sections

By robin - October 12, 2011

Hey Rez,

Something like this might work for you:

<testimonial><?php echo @$slidequotesRecords[$i++]; ?></testimonial>

Hope that helps,
Robin
Robin
Programmer
interactivetools.com

Re: [robin] combining two sections

By rez - October 12, 2011 - edited: October 12, 2011

hmm. So the records are already numbered in the $slidequotesRecords ? This is the type of thing I dont understand yet but anyway, I'm getting the string, "Array" for each result instead of a testimonial. I am assuming i have to make i=1 or 0 first?

list($home_slideshowRecords, $home_slideshowMetaData) = getRecords(array(
'tableName' => 'home_slideshow',
));
list($slidequotesRecords, $slidequotesMetaData) = getRecords(array(
'tableName' => 'testimonials',
'orderBy' => "RAND()",
'limit' => $home_slideshowMetaData['totalRecords'],
));

?><<?php ?>?xml version="1.0" encoding="utf-8"?>
<Slideshow>
<items>
<?php $i = 0; ?>
<?php foreach ($home_slideshowRecords as $home_slideshowRecord): ?>
<?php foreach ($home_slideshowRecord['slide'] as $upload): ?>
<item>
<thumbnailPath><?php echo $upload['thumbUrlPath'] ?></thumbnailPath>
<largeImagePath><?php echo $upload['urlPath'] ?></largeImagePath>
<fullScreenImagePath><?php echo $upload['urlPath'] ?></fullScreenImagePath>
<title><![CDATA[&nbsp;<?php echo $home_slideshowRecord['title'] ?>]]></title>
<description><![CDATA[&nbsp;<?php echo @$slidequotesRecords[$i++]; ?>]]></description>
</item>
<?php endforeach ?>
<?php endforeach ?>
</items>
</Slideshow>

Re: [rez] combining two sections

By robin - October 13, 2011

Hey Res,

Ah, I forgot to mention you need to put the field name also. I'm not sure what you're using for field name, but I'll put content in the example.

<description><![CDATA[&nbsp;<?php echo @$slidequotesRecords[$i++]['content']; ?>]]></description>

Arrays that come out of getRecords() are numbered. You can see the array structure by adding this line:
showme($slidequotesRecords);

You don't strictly need to define $i first, but it is good form. At the top of the page you could add:
$i=0;

Hope that helps,
Robin
Robin
Programmer
interactivetools.com