Pulling in titles to create sub navigation

5 posts by 2 authors in: Forums > CMS Builder
Last Post: May 18, 2011   (RSS)

By Kittybiccy - May 16, 2011

I've got my site pulling in titles to create a sub navigation. This seems to be working fine in some sections but in the 'portfolio' section on the detail pages it pulls in the records fine as navigation but then displays only the fist entry on every detail page within that section.

I guess this is due to this bit :
// load records
list($residentialRecords, $residentialMetaData) = getRecords(array(
'tableName' => 'residential',
));
$residentialRecord = @$residentialRecords[0]; // get first record

Any ideas how I need to change the code to display all records on each's relevant page? Here is the link to the test site: http://domain3318720.sites.fasthosts.com/portfolio_residentialList.php It's displaying record one on every detail page.

Thanks in advance guys! [:)]

Re: [Kittybiccy] Pulling in titles to create sub navigation

By Jason - May 16, 2011

Hi,

I took a look at your page, and what's happening is your showing the same record for each detail page. To show the correct record for each page, try this:

// load records
list($residentialRecords, $residentialMetaData) = getRecords(array(
'tableName' => 'residential',
'where' => whereRecordNumberInUrl(),
));

$residentialRecord = @$residentialRecords[0]; // get first record


Is that closer to what you're looking for?
---------------------------------------------------
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] Pulling in titles to create sub navigation

By Kittybiccy - May 17, 2011

Hi Jason,

Thanks, I had tried that before but when you then go into a detail page it only displays that record title in the sub navigation:
http://domain3318720.sites.fasthosts.com/portfolio_residentialList.php

I need it to display all of the record titles for that section on each detail page as it does on the list page. Is that possible? Thanks!

Re: [Kittybiccy] Pulling in titles to create sub navigation

By Jason - May 17, 2011

Hi,

I assume that in addition to showing all the titles, you also want to display the details of a given selection. Is that right?

If so, what you can do is have 2 queries: 1 that returns just the selected record, and 1 that returns all of the records.

For example:

// get Detail Record
list($residentialDetailRecord, $residentialDetailMetaData) = getRecords(array(
'tableName' => 'residential',
'where' => whereRecordNumberInUrl(),
));

$residentialDetail = @$residentialDetailRecord[0]; // get first record

// get all records from section
list($residentialRecords, $residentialMetaData) = getRecords(array(
'tableName' => 'residential',
'allowSearch' => false,
));


In this example, you have the variable $residentialDetail that is the individual record that was selected, and $residentialRecords that is all the records in your "residential" section.

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/