I have a site with three menus, one per main category of the site. I use pages only. Two main categories have one page in common.
- Category A with menu a
- Category B - with menu b - with tarifs page
- Category C - with menu c - with tarifs page
That tarifs page has to be shown with the proper menu depending on what menu the tarif page was asked from. I tried giving the page the template for main category A realizing I couldn't do that as it would show the wrong menu when it would be picked from the other main category with the same page - category B.
Is there a way to show menu a or b for the tarifs page depending on the menu the user came from? I would be very happy if I could create a tarifs template that could do this.
$_SERVER['HTTP_REFERER'] could be used to determine page / url of origin using HTTP_REFERRER.
I found http://stackoverflow.com/questions/4909443/using-php-serverhttp-referer-to-display-custom-welcome-messages-content mentioning using strpos and HTTP_REFERRER to check for url of origin.
Only wish there would be a nicer way to check for template chosen (body class) and then echo code x