Linking Data to a summary page
13 posts by 3 authors in: Forums > CMS Builder
Last Post: October 27, 2011 (RSS)
Hi Jason
If it was that easy I wouldn't have asked :)! No, that doesn't work, as I get an undefined index, which is why I contacted you in the first place!
There is no tourIntroRecords section editor.
1. there is a section editor for countries = countries list
// determine if a country was selected for searching
$tourIntroWhere = @$_REQUEST['country_list_keyword']
? "country_name LIKE '\t". mysql_real_escape_string( @$_REQUEST['country_list_keyword'] ) ."\t'"
: "title = 'Generic'";
// load intro records
list($tourIntroRecords) = getRecords(array(
'tableName' => 'country_intros',
'where' => $tourIntroWhere,
));
$tourIntroRecord = @$tourIntroRecords[0]; // get first record
2. there is a section editor for the details of each country = country_intros (this also contains the specific country SEO info which I want displayed depending on which country was selected)
3. there is a page tours_summary.php which pulls info from the various sections depending on the search
4. what I want to happen is that if they select Turkey for example, the tours_summary.php displays the image, page title, intro copy AND THE SEO INFO for that section. I don't know how to make it work so that if Turkey was selected as the country, it also then knows that the Turkey country_intro seo info needs to be added to.
Do I need to have another string of code as per 1 above, or can I just add to that, and if so how?
Thanks
If it was that easy I wouldn't have asked :)! No, that doesn't work, as I get an undefined index, which is why I contacted you in the first place!
There is no tourIntroRecords section editor.
1. there is a section editor for countries = countries list
// determine if a country was selected for searching
$tourIntroWhere = @$_REQUEST['country_list_keyword']
? "country_name LIKE '\t". mysql_real_escape_string( @$_REQUEST['country_list_keyword'] ) ."\t'"
: "title = 'Generic'";
// load intro records
list($tourIntroRecords) = getRecords(array(
'tableName' => 'country_intros',
'where' => $tourIntroWhere,
));
$tourIntroRecord = @$tourIntroRecords[0]; // get first record
2. there is a section editor for the details of each country = country_intros (this also contains the specific country SEO info which I want displayed depending on which country was selected)
3. there is a page tours_summary.php which pulls info from the various sections depending on the search
4. what I want to happen is that if they select Turkey for example, the tours_summary.php displays the image, page title, intro copy AND THE SEO INFO for that section. I don't know how to make it work so that if Turkey was selected as the country, it also then knows that the Turkey country_intro seo info needs to be added to.
Do I need to have another string of code as per 1 above, or can I just add to that, and if so how?
Thanks
Re: [degreesnorth] Linking Data to a summary page
By Jason - October 27, 2011
Hi,
You already have code on your page to retrieve a record from country_intros. If you are getting an "undefined index" error, chances are you're query isn't returning anything.
You can confirm this with this piece of code:
If all you get back is "DEBUG ENDS" or Array() DEBUG ENDS, then the query to retrieve a record wasn't successful.
It looks like the field country_name is a text field, or a single value list field. If this is the case, adding tab (\t) characters around your search value wouldn't work.
Try this:
Let me know if this works for you.
You already have code on your page to retrieve a record from country_intros. If you are getting an "undefined index" error, chances are you're query isn't returning anything.
You can confirm this with this piece of code:
$tourIntroRecord = @$tourIntroRecords[0]; // get first record
showme($tourIntroRecord);
die("DEBUG ENDS");
If all you get back is "DEBUG ENDS" or Array() DEBUG ENDS, then the query to retrieve a record wasn't successful.
It looks like the field country_name is a text field, or a single value list field. If this is the case, adding tab (\t) characters around your search value wouldn't work.
Try this:
// determine if a country was selected for searching
$tourIntroWhere = @$_REQUEST['country_list_keyword']
? "country_name = '". mysql_real_escape_string( @$_REQUEST['country_list_keyword'] ) ."'"
: "title = 'Generic'";
Let me know if this works for you.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Hi Jason
Yes, adding that seemed to have worked. I ended up getting a long list of Array( [_filename] => Egypt [_link] => javascript:alert('Set Detail Page Url for this section in: Admin > Section Editors > Viewer Urls') [accommodation] => [country_intro_copy] => Egypt has one of the oldest and most diverse cultural histories in the world and we love it. From the awe-inspiring temples of the Pharaohs to the architectural wonders of the Islamic period, a visit to this country is a fascinating journey through 5000 years of history. Along the way you'll encounter Greeks, Romans, Byzantines, Fatimids, Mamluks and Ottomans - to name but a few. Together with the bountiful Nile Valley, there's also some outstanding desert scenery - and a side-trip to Alexandria is a must. [country_name] => Egypt [country_name:labels] => Array etc, etc... then took the small piece of code out, and then it works.Thanks for that. I don't understand it, but it works so am happy :)!Cheers
Yes, adding that seemed to have worked. I ended up getting a long list of Array( [_filename] => Egypt [_link] => javascript:alert('Set Detail Page Url for this section in: Admin > Section Editors > Viewer Urls') [accommodation] => [country_intro_copy] => Egypt has one of the oldest and most diverse cultural histories in the world and we love it. From the awe-inspiring temples of the Pharaohs to the architectural wonders of the Islamic period, a visit to this country is a fascinating journey through 5000 years of history. Along the way you'll encounter Greeks, Romans, Byzantines, Fatimids, Mamluks and Ottomans - to name but a few. Together with the bountiful Nile Valley, there's also some outstanding desert scenery - and a side-trip to Alexandria is a must. [country_name] => Egypt [country_name:labels] => Array etc, etc... then took the small piece of code out, and then it works.Thanks for that. I don't understand it, but it works so am happy :)!Cheers