not selecting the right record

4 posts by 2 authors in: Forums > CMS Builder
Last Post: November 2, 2009   (RSS)

my multi-record section is not pulling the right source record (for some parts but others it works fine.

this is the source page:
http://www.tpschool.org/stu/overview.php

It loads the multi-record sub-sections onto the page. When you load one of the subsections a subnav menu of all the other options also loads on the page.

The "title" of the record is pulled to use in the page title. However, when you change to one of the other subsections the data on the page changes correctly but the page title does not change.

Here is the code on the list page:

<?php

require_once "/usr/www/users/thephila/cmsAdmin/lib/viewer_functions.php";

list($stu_resourcesRecords, $stu_resourcesMetaData) = getRecords(array(
'tableName' => 'stu_resources',
'where' => whereRecordNumberInUrl(1),
'loadUploads' => '0',
'orderBy' => 'box ASC',
));
$stu_resourcesRecord = @$stu_resourcesRecords[0]; // get first record

// show error message if no matching record is found
if (!$stu_resourcesRecord) {
print "Record not found!";
exit;
}
list($stu_overviewRecords, $stu_overviewMetaData) = getRecords(array(
'tableName' => 'stu_overview',
'where' => whereRecordNumberInUrl(1),
'loadUploads' => '0',
'limit' => '1',
));
$stu_overviewRecord = @$stu_overviewRecords[0]; // get first record

// show error message if no matching record is found
if (!$stu_overviewRecord) {
print "Record not found!";
exit;
}

?>


here is the code for the viewer page - I am pretty sure the problem occurs because of the get first record code but I am drawing a blank on how to get around it.

<?php

require_once "/usr/www/users/thephila/cmsAdmin/lib/viewer_functions.php";

list($stu_resourcesRecords, $stu_resourcesMetaData) = getRecords(array(
'tableName' => 'stu_resources',
'limit' => '1',
));

$stu_resourcesRecord = @$stu_resourcesRecords[0]; // get first record


// show error message if no matching record is found
if (!$stu_resourcesRecord) {
print "Record not found!";
exit;
}

?>

Any help is appreciated - thanks.

Re: [craighodges] not selecting the right record

By Dave - October 29, 2009

Hi Craig,

Can you attach both files to this thread? If I can see how the code is outputting the title value that will help me figure out what the issue is.

Thanks!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] not selecting the right record

thanks Dave -

There are three primary files.

1 - overview.php is the main page
2 - viewres_stu.php is the viewer page
3 - substu.php creates a subnav menu

You will see the page title is pulled from the title in CMSB. but it always pulls the first record - even when you change records.

Thanks

Craig