Not seeing the problem

6 posts by 2 authors in: Forums > CMS Builder
Last Post: December 19, 2012   (RSS)

Hi,

The most likely problem is with this line:
<?php foreach ($record['image'] as $index => $upload): ?>
Is the field name for your upload field definitely image? Secondly have you uploaded any images for these entries, as CMS Builder doesn't send an image array at all if no uploads have been added which would cause the code to display the same error.

If it's neither of these problems would it be possible to post or attach the code for the entire file?

Thanks!

Greg
Greg Thomas







PHP Programmer - interactivetools.com
I did change the field to main_image and checked and all the entries have a picture uploaded.

New error message shows the change:

Notice: Undefined index: main_image in D:\HostingSpaces\rileytours\rileytours.com\wwwroot\tours_season.php on line 226 Warning: Invalid argument supplied for foreach() in D:\HostingSpaces\rileytours\rileytours.com\wwwroot\tours_season.php on line 226

Michael Moyers



Owner of Just Rite Design Inc. A growing network of professionals in web design, graphic design, flash development, programming, and audio & video productions.



"Due to budget constraints, the Light at the end of the tunnel will be temporarily out!"
Sorry Greg,
Missed the bit about the complete file ... Here it is
Michael Moyers



Owner of Just Rite Design Inc. A growing network of professionals in web design, graphic design, flash development, programming, and audio & video productions.



"Due to budget constraints, the Light at the end of the tunnel will be temporarily out!"
Attachments:

tours_season.php 12K

I think I've spotted the problem. You've currently got loadUploads set to false in your getRecords function for the all_tours table, so the function isn't retrieving any of your uploaded files. If you change line 27 so that loadUploads is set to true, this should solve the problem.

list($all_toursRecords, $all_toursMetaData) = getRecords(array(
'tableName' => 'all_tours',
'loadUploads' => true,
'allowSearch' => false,
));


Thanks

Greg
Greg Thomas







PHP Programmer - interactivetools.com
Thanks Greg that was the ticket.
Michael Moyers



Owner of Just Rite Design Inc. A growing network of professionals in web design, graphic design, flash development, programming, and audio & video productions.



"Due to budget constraints, the Light at the end of the tunnel will be temporarily out!"