Super Navigation

ExpressionEngine 4, ExpressionEngine 5, ExpressionEngine 6

Back to this add-on's main page
View Other Add-ons From Amici Infotech


You must be logged in to post.

How can I get tree level



Hello, I have 2 questions.

1 - Is there a chance to get the level of the menu? (I’m working with a 3 level tree )

2- How can I define what should html render when using {nav:child:render}

Thanks in advance

Here are 2 links with the tree and how should render

Amici Infotech
# 1
Amici Infotech

Hey, Right now, there is no way you can get level of nav tree. so you cant get current level. (Nice feature to add. I will add it in next realease)

For your case, You have 3 level menu where I guess, First level is main nav, second level is heading under megamenu and 3rd level is actual links.

You can identify level with condition like this:

{if parent_id == 0}
<!-- I am on root level (level 1) -->
{if:elseif has_children}
<!-- this is 2nd level -->
<!-- this is 3rd level -->

For 2nd question, You dont have new html in {nav:child:render}, Main tagdata cloned here. So for given example, item marked in red box will be cloned again for child nav.

That’s why you can use above conditions to manipulate data by level.

Let me know if you have any queries.

[Amici Infotech Support]