Detail page display

6 posts by 3 authors in: Forums > CMS Builder
Last Post: September 10, 2010   (RSS)

Strange one - on one detail page a record which is drawn in from another section works fine but on another detail page (using same page template) this section does not display correctly - can anyone suggest why?

Not working: http://www.blackswan.org.uk/cmsb/fundraising_black_swan_arts_Detail.php?Commissioned-Textile-Prints-of-Black-Swan-Arts-and-Frome-by-Clare-Halifax-2

Warning: Invalid argument supplied for foreach() in /mnt/stor2-wc2-dfw1/436122/www.blackswan.org.uk/web/content/cmsb/fundraising_black_swan_arts_Detail.php on line 177

Working fine:
http://www.blackswan.org.uk/cmsb/fundraising_black_swan_arts_Detail.php?Car-Art-Boot-Sale-1

Thanks!

Re: [Kittybiccy] Detail page display

By Jason - September 9, 2010

Hi,

I would need to actually see your code to be sure, but I think what's happening is the record your supplying for "Current Exhibition" is being selected based on the record number in the url. On the example you gave that isn't working, the last number in the URL is 2. If there isn't an exhibition record with the number 2, then it would be an empty record that your passing into your foreachloop.

You would probably want to change how you're selecting your exhibitions. Perhaps just selecting the most recent record.

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] Detail page display

By Chris - September 9, 2010

Please post the complete PHP source code for your fundraising_black_swan_arts_Detail.php page. :)
All the best,
Chris

Re: [chris] Detail page display

Hi Chris,
I'll attach the page so as not to fill the thread with code!:)

Re: [Kittybiccy] Detail page display

By Jason - September 10, 2010

Hi,

I think the problem you're having is in this code here:
// load records
list($current_exhibition_thumbRecords, $current_exhibition_thumbMetaData) = getRecords(array(
'tableName' => 'current_exhibition_thumb',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$current_exhibition_thumbRecord = @$current_exhibition_thumbRecords[0]; // get first record


You're selecting an exhibition record based on a record number in the url string. However, the record number in your string is referring to a fund raising record. If the fund raising record number in the url string doesn't match a record in the exhibition table, then the variable $current_exhibition will have no value. Since you're using the "@" symbol, you're suppressing the error message.

You'll need to use a different criteria to select your exhibition record. You could try something like this:
// load records
list($current_exhibition_thumbRecords, $current_exhibition_thumbMetaData) = getRecords(array(
'tableName' => 'current_exhibition_thumb',
'allowSearch' => false,
'limit' => '1',
));
$current_exhibition_thumbRecord = @$current_exhibition_thumbRecords[0]; // get first record


This will just select the first record in your exhibition list (probably the last one added)

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/