Developer forum

Forum » Development » Custom parameter dwnavigation

Custom parameter dwnavigation

Martin Grønbekk Moen
Reply

Is it possible to add a custom parameter to dwnavigation?

<div id="sub-menu" class="dwnavigation" settings="template:SubNavigation.xslt;startlevel:2;test:true;">

So that in the XSLT I can fetch it by using something like this.

<ul class="M1" test="@test">

Replies

 
Morten Bengtson
Reply
This post has been marked as an answer

Yes, this is possible. Your custom parameters will be included as attributes on  the LayoutNavigationSettings element in the navigation XML...

<?xml version="1.0" encoding="utf-8"?>
<NavigationTree>
    <Settings>
        <Pageview ID="1" AreaID="1" MenuText="Frontpage" Title="Frontpage" NavigationName="TopNavigation" AreaName="Standard" />
        <LayoutNavigationSettings template="TopNavigation.xslt" test="true" />
        <LayoutNavigationAttributes title="nav-primary" class="" />
        ...
    </Settings>
    ...
</NavigationTree>

You should be able to fetch that value in your XSLT like this...

<ul class="M1" test="{/NavigationTree/Settings/LayoutNavigationSettings/@test}">
...
</ul>

 

Note: Besides the parameters you provide in the settings attribute, other attributes like class and title will be available in the XML as attributes on the LayoutNavigationAttributes element.

Votes for this answer: 1
 
Martin Grønbekk Moen
Reply

Perfect! It works, thanks :)

 

You must be logged in to post in the forum