Sidebar navigation display changes depending on which page the user comes in from?
Permalink
OK, I'm trying to set up navigation on a site that will, as the post title suggests, display a differnt set of links depending on which page the user comes in from.
I am new to C5 but I know some PHP(slightly beyond the basics), & I think I know in theory what needs to be done. It should be similar to a breadcrumb trail, but I'm not sure which files I need to alter.
Anyone any tips for this, I would be much obliged.
I am new to C5 but I know some PHP(slightly beyond the basics), & I think I know in theory what needs to be done. It should be similar to a breadcrumb trail, but I'm not sure which files I need to alter.
Anyone any tips for this, I would be much obliged.
Apologies for the ambiguity.
Exactly... '"if they came from these pages, show set of links A, and if they came from other pages show set of links B"'.
Exactly... '"if they came from these pages, show set of links A, and if they came from other pages show set of links B"'.
I would probably just put an "If" statement in your page type templates, like this:
Note that I've put in a check for "isEditMode" so you can see both areas when you edit the page (so you can put the appropriate autonav blocks in them or whatever it is you want to show up for different people).
<?php $special_pages = array('http://domain.com/some-special-page', 'http://domain.com/another-special-page', 'http://domain.com/yet-another-page'); $is_special = in_array($_SERVER['HTTP_REFERER'], $special_pages); if ($is_special || $c->isEditMode()) { $a = new Area('Nav 1'); } if (!$is_special || $c->isEditMode()) { $a = new Area('Nav 2); }
Note that I've put in a check for "isEditMode" so you can see both areas when you edit the page (so you can put the appropriate autonav blocks in them or whatever it is you want to show up for different people).
Thanks for the prompt reply.
I thought it was an if statement but didn't know where to put it.
I'm still trying to come to terms with C5's PHP, which incidentally, is some of the tidiest PHP I've ever seen.
Thanks again Jordan...
I thought it was an if statement but didn't know where to put it.
I'm still trying to come to terms with C5's PHP, which incidentally, is some of the tidiest PHP I've ever seen.
Thanks again Jordan...
(Or something else entirely)?