Detail page within a detail page

3 posts by 2 authors in: Forums > CMS Builder
Last Post: June 24, 2008   (RSS)

By rjbathgate - June 24, 2008

Firstly, a huge thank you Dave for your help on my last question!

I have a detail page, on which I have a link to a second detail page. I'm having real trouble keeping the record the same - i.e. say we're on record D on detail page 1, when clicking the link to detail page 2, we're loosing the fact we're on record D.

On detail page 1, we have:
<a href="detail-two.php">View Floor Plan</a>

I've tried making the link as:
<a href="detail-two.php?reference=<?php echo $saleRecord['reference'] ?>">View Floor Plan</a>

To make it point to detail-two.php?reference=D for example, but this doesn't work.

Also tried adding in code into there where => of step 1 of detail page 2, but nothing i've tried works - we either revert to record A, or no record at all.

I can see it being really easy and obvious, but can't get it to work anyway I try...

Normally I would just use:
<?php echo $saleRecord['_link'] ?>
but this obviously reverts to the first detail page as defined in the admin setup of the table in the CMS.

NB will ultimately have more than one additional detail page, but presuming solution to this will work for others.

Thank you heaps in advance,

Rob

Re: [rjbathgate] Detail page within a detail page

By Dave - June 24, 2008

Hi Rob,

The detail viewer looks for the record number on the end of the url by default. So all you need to do is add that:
<a href="detail-two.php?<?php echo $saleRecord['num'] ?>">View Floor Plan</a>

If you want the keywords in the url too from the title (or whatever you have it set to (if it's setup) you can get that with <?php echo $saleRecord['_filename'] ?> so you'd use:
<a href="detail-two.php?<?php echo $saleRecord['_filename'] ?>-<?php echo $saleRecord['num'] ?>">View Floor Plan</a>

If you haven't used those yet you can take a look under: Admin > Section Editors > Viewer Urls > Filename Fields.

And some great debugging code if you want to see all the "fields" that are available inside a variable is this:
<xmp><?php print_r($saleRecord); ?></xmp>

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com