Developer forum

Forum » Templates » Exclude menu item in specific menu

Exclude menu item in specific menu


Reply
Hi,

I do have a problem - i need to exclude a specific menu item, caled "blog" in the footer mega-menu.
The item need to be in my global menu - so i was wondering how i do exclude a single item from one menu, and not the other.

My code as for now:
<ul title="Top navigation" class="dwnavigation" id="footerul" settings="startlevel:1;endlevel:2;expandmode:All;">


Greetings
Joachim

Replies

 
Reply
Hi there,

You could use a separate XSLT file for the Footer menu and filter out the item by its ID.

Imar
 
Reply
Hi Joachim,

You can use Test in XSLT, could be done like this: (if the ID is "1").

 
    <xsl:choose>
      <xsl:when test="@ID!='1'">
        <a class="{@class}">
          <xsl:attribute name="href">
            <xsl:value-of select="@FriendlyHref" disable-output-escaping="yes"/>
          </xsl:attribute>
          <xsl:value-of select="@MenuText" disable-output-escaping="yes"/>
        </a>
      </xsl:when>
    </xsl:choose>
 
Reply
That works perfectly! Thanks alot.

Im very sorry, but im all new to xslt, and i have some very basical questions.

How do you use "mode" expand:all? Now i only gets the level 1 item's

Here is my code:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

  <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"  encoding="utf-8" />
  <xsl:param name="html-content-type" />
  <xsl:template match="/NavigationTree">
    <ul class="M0">
      <xsl:apply-templates select="Page">
       
      </xsl:apply-templates>
    </ul>

  </xsl:template>

  <xsl:template match="Page">
    <li class="{@class}">
        <xsl:choose>
          <xsl:when test="@ID!='6'">
            <a class="{@class}">
              <xsl:attribute name="href">
                <xsl:value-of select="@FriendlyHref" disable-output-escaping="yes"/>
              </xsl:attribute>
              <xsl:value-of select="@MenuText" disable-output-escaping="yes"/>
            </a>
          </xsl:when>
        </xsl:choose>
    </li>
  </xsl:template>

</xsl:stylesheet>
 
Reply
Take a look at the file LIClean.xslt from the /Files/Templates/Navigation folder.

It recursively builds up the menu by calling <xsl:apply-templates select="Page"> again. You may want to use this file as your starting point as it's one the cleaner XSLT files for navigation.

Hope this helps,

Imar
 
Reply
Works perfectly, and as intended now.
Thanks for the help both of you!

- Joachim

 

You must be logged in to post in the forum