Display results from different sections

14 posts by 2 authors in: Forums > CMS Builder
Last Post: October 27, 2010   (RSS)

By degreesnorth - October 24, 2010

Hi Chris

The array section for the dates didn't work, so created a seperate editor for the days, so still need to work out how to "group the results". Any ideas would be great.

However, this search is not pulling across all of the data. It's pulling across the "tours" section, but not the escorted, polar or river cruises. Do I need to add something to the results page to get this to display as well? Here's the header code:

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


// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/clientdata/zeus-dynamic-1/a/c/activetravel.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($toursRecords, $toursMetaData) = getRecords(array(
'tableName' => 'tours',
'allowSearch' => '0',
));

// load records
list($escorted_toursRecords, $escorted_toursMetaData) = getRecords(array(
'tableName' => 'escorted_tours',
'allowSearch' => '0',
));

// load records
list($polar_toursRecords, $polar_toursMetaData) = getRecords(array(
'tableName' => 'polar_tours',
));

// load records
list($river_cruisesRecords, $river_cruisesMetaData) = getRecords(array(
'tableName' => 'river_cruises',
));


But then how do I deal with the "php for each" statement, ie... <?php foreach ($river_cruisesRecords as $record): ?> and <?php foreach ($escorted_toursRecords as $record): ?>
... do I need to add these somehow? The page they all need to be summarised to is http://acac6262.staging-zeus.netregistry.net/tours_summary.php?country_list=India&type_of_holiday=&length_of_trip=&submit=View+trips but that's only showing more than a dozen times???

Terribly stuck! I have attached the summary page code as a text file if that helps.
Attachments:

tours_summary.txt 16K

By degreesnorth - October 26, 2010

The last string of code works a dream. Thanks!

So, just one last question to solve this section... the array for grouping the days. The days are currently in a section editor, with the 'days' field each a seperate file from 1 to 30. If I need to group these into:
- any/all (ie, not important)
- 1 to 5 days
- 5 to 10 days
- 10 to 15 days
- 15 to 20 days
- 20 to 25 days
- more than 25 days

How would I go about doing this?

Re: [degreesnorth] Display results from different sections

By Chris - October 27, 2010

Hi degreesnorth,

I think you'll want to use the [url http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html]_min and _max search suffixes.[/url]

For example, you could put this at the very top of your script (before your getRecords()):

$days = @$_REQUEST['number_of_days'];
delete $_REQUEST['number_of_days'];
if ($days == '1 to 5 days' ) { $_REQUEST['number_of_days_min'] = 1; $_REQUEST['number_of_days_max'] = 5; }
if ($days == '5 to 10 days' ) { $_REQUEST['number_of_days_min'] = 5; $_REQUEST['number_of_days_max'] = 10; }
if ($days == '10 to 15 days' ) { $_REQUEST['number_of_days_min'] = 10; $_REQUEST['number_of_days_max'] = 15; }
if ($days == '15 to 20 days' ) { $_REQUEST['number_of_days_min'] = 15; $_REQUEST['number_of_days_max'] = 20; }
if ($days == '20 to 25 days' ) { $_REQUEST['number_of_days_min'] = 20; $_REQUEST['number_of_days_max'] = 25; }
if ($days == 'more than 25 days') { $_REQUEST['number_of_days_min'] = 26; }


Does that help?
All the best,
Chris