Module

Archived
Forum
(read-only)


For official support, visit the official support site »

Super Navigation

ExpressionEngine 4, ExpressionEngine 5, ExpressionEngine 6

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

     

How can I get tree level

General

esmithtimberline
esmithtimberline

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

https://d.pr/i/IkmXF2

https://d.pr/i/ogZBSc

Amici Infotech
# 1
Developer
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 -->
{if:else}
    
<!-- this is 3rd level -->
{/if} 

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. https://prnt.sc/126qfce

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

Let me know if you have any queries.

Thanks,
Mufi
[Amici Infotech Support]