Image Slider

4 posts by 2 authors in: Forums > CMS Builder
Last Post: February 10, 2012   (RSS)

By kdub718 - February 9, 2012

I want to put a image slider that will pull images from my single record with multiple uploads for my main page.

I feel like I'm missing something simple!

I get this error (Notice: Undefined variable: record in...)

foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

// load records
list($mainRecords, $mainMetaData) = getRecords(array(
'tableName' => 'main',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$mainRecord = @$mainRecords[0]; // get first record


<div class="flexslider">
<ul class="slides">
<?php foreach ($record['upload'] as $upload): ?>
<li>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" />
</li>
<?php endforeach ?>
</ul>
</div><!--end:flexslider-->

Re: [kdub718] Image Slider

By robin - February 10, 2012

Hey,

Looks like you have a variable name mixup. You've created a your record variable as $mainRecord, but your foreach loop is looking for $record.

If you switch your foreach to something like this it should help:
<?php foreach ($mainRecord['upload'] as $upload): ?>

Hope that helps,
Robin
Robin
Programmer
interactivetools.com

Re: [robin] Image Slider

Hey,

Looks like you have a variable name mixup. You've created a your record variable as $mainRecord, but your foreach loop is looking for $record.

If you switch your foreach to something like this it should help:
<?php foreach ($mainRecord['upload'] as $upload): ?>

Hope that helps,
Robin


I got it working... I thought I would post incase anyone in the future has this same problem I did... anyway..

I used this:
<?php foreach ($mainRecord['image'] as $upload): ?>

Thanks for your help,