Help needed to add content from multiple sections on one page

20 posts by 8 authors in: Forums > CMS Builder
Last Post: August 12, 2010   (RSS)

By PixelFusion - September 30, 2008

I have a very similar thing I want to accomplish. I was able to get the list page working but I'm having problems with the details page. I need to combine the following.

<?php

require_once "/home/cmsdemo/www/cmsdemo.pixelfusion3.net/cmsAdmin/lib/viewer_functions.php";

list($solutionsRecords, $solutionsMetaData) = getRecords(array(
'tableName' => 'solutions',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$solutionsRecord = @$solutionsRecords[0]; // get first record

?>




AND

<?php

require_once "/home/cmsdemo/www/cmsdemo.pixelfusion3.net/cmsAdmin/lib/viewer_functions.php";

list($menuRecords, $menuMetaData) = getRecords(array(
'tableName' => 'menu',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$menuRecord = @$menuRecords[0]; // get first record

?>




I tried the following but it only shows the first item.

<?php

require_once "/home/cmsdemo/www/cmsdemo.pixelfusion3.net/cmsAdmin/lib/viewer_functions.php";

list($solutionsRecords, $solutionsMetaData) = getRecords(array(
'tableName' => 'solutions',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$solutionsRecord = @$solutionsRecords[0]; // get first record

list($menuRecords, $menuMetaData) = getRecords(array(
'tableName' => 'menu',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$menuRecord = @$menuRecords[0]; // get first record

?>


Re: [PixelFusion] Help needed to add content from multiple sections on one page

By degreesnorth - August 10, 2010

Hi there

I too am trying to do something similar to this but keep getting an error. My issue: I have a single summary page (tours_summary) and I want to pull data which is on a tours page (page is called tours). I get a broken link message - and am completely baffled! Please help.

Here's the code I'm using:

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php


// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/clientdata/n5200-2-dynamic/w/o/worldshores.com.au/www/','','../','../../','../../../');
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($tours_summaryRecords, $tours_summaryMetaData) = getRecords(array(
'tableName' => 'tours_summary',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$tours_summaryRecord = @$tours_summaryRecords[0]; // get first record

list($toursRecords, $toursMetaData) = getRecords(array(
'tableName' => 'tours',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$toursRecord = @$toursRecords[0]; // get first record

// show error message if no matching record is found
if (!$tours_summaryRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}

?>



Thanks

Re: [degreesnorth] Help needed to add content from multiple sections on one page

By Jason - August 10, 2010

Hi,

What exactly is the error message you're getting? Can you provide a link to the page in question so I can see it in action?

If you could send that information, I can take a closer look at this problem.

Thanks.
---------------------------------------------------
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] Help needed to add content from multiple sections on one page

By degreesnorth - August 10, 2010

Hi Jason
That's the problem - it doesn't display - I get a message saying this page isn't available - see http://www.worldshores.com.au/tourssummary.php

I have attached the full page code as a text file. I have checked the forum, but there is no single conclusive piece of documentation that indicates how to:
1) have a summary page
2) pull data from another section (ie, detailed tours) so that it only displays some of the information on the summary tour page. So when someone clicks on the summary page, they see at a glance a snapshot of all the tours, and can click thru to the details of that tour.
3) I was hoping not to have to duplicate some of the fields from the detailed tour page onto another page, but rather just "pull" it from the "master" detailed tour page.

Is that possible?
Thanks

Re: [degreesnorth] Help needed to add content from multiple sections on one page

By Jason - August 11, 2010

Hi,

Yes, it is possible, you can pull whatever information you want from the main tours page and only display the information you want.

The problem you're running into is that your queries are not returning any data. You're using this code:

// load records
list($tours_summaryRecords, $tours_summaryMetaData) = getRecords(array(
'tableName' => 'tours_summary',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$tours_summaryRecord = @$tours_summaryRecords[0]; // get first record

list($toursRecords, $toursMetaData) = getRecords(array(
'tableName' => 'tours',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$toursRecord = @$toursRecords[0]; // get first record


You're using the "whereRecordNumberInUrl()" function that is looking for a record number in the url string. If it doesn't find one, it returns the number 1. If there is no record number 1, then you're not going to be returning any data.

If you can put the record number of the record you're trying to retrieve at the end of the query string (example: http://www.worldshores.com.au/tourssummary.php?14 ).

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] Help needed to add content from multiple sections on one page

By degreesnorth - August 11, 2010

Hi Jason

Thanks, but that isn't working. The tour_summary is a single page, so by default it should only pull record 1. So, the tours_summary record is a single page, which has a bit of a generic intro, and THEN I want to list the tours in summary form below, taking the data from tours ('tableName' => 'tours',).
How do I make that work?
Thanks in advance.

Carole

Re: [degreesnorth] Help needed to add content from multiple sections on one page

By Chris - August 11, 2010

Hi Carole,

This is certainly possible, and you're very close to the solution, but I'm concerned about the error you're getting, so let's back up a step.

When I go to [url http://www.worldshores.com.au/tourssummary.php]http://www.worldshores.com.au/tourssummary.php[/url] I get a message saying "Record not found!" From the code you posted above, that should only happen when the tours_summary record hasn't been loaded. Let's forget about your tours section for a moment and get rid of that error. Do you have a working page which displays your tours_summary record? Can you post the complete PHP source code to a working tours_summary page?
All the best,
Chris

Re: [chris] Help needed to add content from multiple sections on one page

By degreesnorth - August 11, 2010

Hi Chris

The page is definitely loaded on the webserver. And the view URL is /tours_summary/tourssummary.php which I trust is correct? as the table name is tours_summary

The full code is attached as a txt file. Any light shed on this would be helpful!
Thanks!
Attachments:

tourssummary.txt 32K

Re: [degreesnorth] Help needed to add content from multiple sections on one page

By Chris - August 12, 2010 - edited: August 12, 2010

Hi Carole,

Could you please fill out a [url http://www.interactivetools.com/support/]2nd Level Support Request[/url] with your FTP details? I'd like to help you get to the bottom of this.

Oh, and please add my name and a link to this forum thread to the comments section of the request. :)
All the best,
Chris