interior navigation built from cmsb not loading right record
5 posts by 2 authors in: Forums > CMS Builder
Last Post: September 4, 2009 (RSS)
I am building a large site with CMSB (so awesome) I have an issue where the interior subnav is not working:
This is the source page: http://www.tpschool.org/stu/overview.php (a photo gets put in automatically in the blank space in the upper left).
Then when you select one of the sub nav sections: Primary unit for example: http://www.tpschool.org/stu/viewres_stu.php?Primary-Unit-2
The photo is replaced by interior navigation. There is a little phpfile which is building the menu (see below)
<?php
require_once "/usr/www/users/thephila/cmsAdmin/lib/viewer_functions.php";
list($stu_resourcesRecords, $stu_resourcesMetaData) = getRecords(array(
'tableName' => 'stu_resources',
'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;
}
?>
<table>
<tr>
<td style="width: 300px; vertical-align:top;" >
<table style="width: 100%">
<tr>
<td style="width: 300px; vertical-align:top;" class="subnav_background">
<div id="sub">
<ul>
<li><a href="http://www.tpschool.org/stu/overview.php" class="pad">Student Overview Home</a></li>
<?php foreach ($stu_resourcesRecords as $record): ?>
<li><a href="<?php echo $record['_link'] ?>" class="pad"><?php echo $record['title'] ?></a></li>
<?php endforeach; ?>
</ul>
</div>
</td>
here is the problem. When I leave out the where statement, the interior nav is created correctly but the links don't work. When I put in the where statement, it only creates a link for the subnav page you have selected.
When the where statement is out, it created the link properly in that it is the same as the link from the overview page, it just does not work.
Any help is appreciated.
Craig
Re: [craighodges] interior navigation built from cmsb not loading right record
By Chris - September 3, 2009
I'm confused about what the problem is. What is this "where statement" you're referring to?
Chris
Re: [chris] interior navigation built from cmsb not loading right record
'where' => whereRecordNumberInUrl(1),
when that is in, the menu does not build all the options but the links it builds work. When it is not, it builds all the links but despite the url being correct, they don't work.
Re: [craighodges] interior navigation built from cmsb not loading right record
By Chris - September 4, 2009 - edited: September 4, 2009
Without seeing the PHP source code for the entire page I can't know for sure how to solve this, but I can hazard a guess:
I think you want to both get the selected record (from the URL) and a list of all the records in your stu_resources section. Try replacing your STEP 1 code with the following:
<?php
require_once "/usr/www/users/thephila/cmsAdmin/lib/viewer_functions.php";
list($selected_stu_resourcesRecords, $stu_resourcesMetaData) = getRecords(array(
'tableName' => 'stu_resources',
'where' => whereRecordNumberInUrl(1),
));
$stu_resourcesRecord = @$selected_stu_resourcesRecords[0]; // get first record
list($stu_resourcesRecords, $stu_resourcesMetaData) = getRecords(array(
'tableName' => 'stu_resources',
'loadUploads' => '0',
'orderBy' => 'box ASC',
));
// show error message if no matching record is found
if (!$stu_resourcesRecord) {
print "Record not found!";
exit;
}
?>
I'm still not sure why your links wouldn't work, but let's fix one thing at a time.
If that doesn't help, please post the PHP source code for your entire page as an attachment (or multiple attachments if you're using includes.)
Chris
Re: [chris] interior navigation built from cmsb not loading right record
You guys are terrific and I CSMB is absolutely wonderful.
Thanks again.