Detail page as sub navigation

12 posts by 3 authors in: Forums > CMS Builder
Last Post: August 7, 2012   (RSS)

By Kittybiccy - July 26, 2012

Hi guys,

I am using the record titles as a level of sub navigation which is fine although when you are then on the record detail page, the sub navigation is only listing that record. I know I need to adjust something to do with the 'where' or 'limit' clauses bit but could someone tell me to what?

Here is the List page: http://www.fly7.co.uk/test/our-helicoptersList.php

Thanks!

Re: [Kittybiccy] Detail page as sub navigation

By ross - July 27, 2012

Hi there.

Thanks for posting!

I see what you mean with the navigation. What you'll want to do is add the following to your viewer code for the list of page titles (not the viewer that loads your single record):

'allowSearch' => false,

That should get you going. Give that a shot and let me know how you make out.

Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ross] Detail page as sub navigation

By Kittybiccy - July 30, 2012

Hi Ross,

I already seem to have that line:
// load record from 'our_helicopters_list'
list($our_helicopters_listRecords, $our_helicopters_listMetaData) = getRecords(array(
'tableName' => 'our_helicopters_list',
'where' => whereRecordNumberInUrl(0),
'loadUploads' => true,
'allowSearch' => false,
'limit' => '1',
));
$our_helicopters_listRecord = @$our_helicopters_listRecords[0]; // get first record
if (!$our_helicopters_listRecord) { dieWith404("Record not found!"); } // show error message if no record found

Any other suggestions? Is it because of the 'limit' part?

Re: [Kittybiccy] Detail page as sub navigation

By Jason - July 30, 2012

Hi,

Your query is set up to retrieve only a single record, based on the record number in the URL. The first thing you'll need to do is remove the "limit" option from your getRecords() call.

After that, you'll want to remove your "where" option. If you want to return all the records from your "our_helicopters_list" section, you won't need either of these options.

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] Detail page as sub navigation

By Kittybiccy - July 31, 2012

Hi Jason,

That kind of works! When I do that, although the records are all listed as a sub navigation, it only allows me to view the first recored (even if I click on the link for the second). Any ideas? Thanks!

Re: [Kittybiccy] Detail page as sub navigation

By Jason - July 31, 2012

Hi,

Could you attach our-helicoptersDetail.php so we can take a closer look at the code here.

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: [Kittybiccy] Detail page as sub navigation

By Jason - August 3, 2012

Hi,

Your attachment didn't seem to come through. Could you try attaching it again?

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] Detail page as sub navigation

By Kittybiccy - August 6, 2012

Hoping this works!
Attachments:

our-helicoptersdetail.php 10K

Re: [Kittybiccy] Detail page as sub navigation

By Jason - August 6, 2012

Hi,

There are a couple of issue in the code here. First, you are using the record set of your detail record to output your list. That's why you're only ever seeing the helicopter you selected in your navigation.

Try changing this:

<?php foreach ($our_helicopters_listRecords as $record): ?>

to this:

<?php foreach ($our_helicoptersRecords as $record): ?>

The second issue is that $our_helicoptersRecords is only set to return a single record (ie limit 1). Try removing that here:

// load record from 'our_helicopters'
list($our_helicoptersRecords, $our_helicoptersMetaData) = getRecords(array(
'tableName' => 'our_helicopters',
'where' => '', // load first record
'loadUploads' => true,
'allowSearch' => false,
'limit' => '1',
));


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/