We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum
Forum
Highlight current category in main menu
Using a standard version of Perch. I have a top menu that shows product categories. These all then related to a physical page. When I am on these pages, how can I highlight in the menu the current page. As these are categories and not pages. <perch:if exists="current_page"> won't work.
Here is some code that might help?
<li>
<a href="/<perch:category id="catPath" />" <perch:if id="catPath" match="eq" value="{perch_page_path}">class="current"</perch:if>>
<perch:category id="catTitle" type="smarttext" label="Title" required="true" />
</a>
</li>
<perch:category id="catSlug" type="slug" for="catTitle" suppress="true" />
<perch:showall />
Full pages live in /products/power/ for example or /products/lighting-display/
here is what the showall is giving;
ID Value
domain http://dengrove.loc
url http://dengrove.loc/products/lighting-display/
sitename Dengrove Marketing Limited
description
sharing_image /assets/img/social-sharing-default.jpg
twittername
og_author
page_title Lighting display
perch_page_path /products/lighting-display.php
current_category false
catPath products/lighting-display/
catID 3
setID 1
catParentID 0
catTitle Lighting & Display
catSlug lighting-display
catDisplayPath Lighting & Display
catOrder 3
catTreePosition 001-003
catDynamicFields {"catPath":"products\/lighting-display\/"}
perch_catPath products/lighting-display/
catDepth 1
perch_item_zero_index 2
perch_item_index 3
perch_item_rev_index 4
perch_item_rev_zero_index 3
perch_item_odd
perch_item_count 6
perch_namespace perch:category
Want to reply to this thread?
Login with Perch
You should be able to pass it into the template - presuming you know from the URL what the correct category should be.
and then
The problem I can't seem to get around is how to get the
When I try this;
I get the following;
So use
'/'.$url