Developer forum

Forum » Templates » Navigation: Pages and Ecom groups sort order and styling

Navigation: Pages and Ecom groups sort order and styling

Thomas Nielsen
Reply
Hi,

I have a leftnavigation, where the 2 first items are the pages on the current page, and the rest of the items are groups from Ecom.

I would like to separate these two parts, so Ecom groups comes first and pages last.
Also i would like to add them in a <ul> for each, so i can style them differently.

Is this possible and if yes where can i control this?

Attaching the current LeftNavigation xslt template.

Regards
Thomas


Replies

 
Yury Zhukovskiy
Reply

Hi Thomas.

Provide please 

  • Id or URL of the page where you have added ecom groups as subpages.
  • Id or URL of the page where you want to show the menu.

Based on this info I will receive result Navigation XML. Then we will prepare required XSLT according your requirements.

 

 

Kind Regards

Zhukovskiy Yury

 
Thomas Nielsen
Reply
Hi Yury,

1) The URL to the page is: http://blaahoejel.net.dynamicweb-cms.com/Webshop.aspx
The 2 pages are VAREKURV, HANDELSBETINGELSER and i would like these at the end of the menu, with the possibility to style them individually.

2) It's the left navigation for all pages under webshop

I hope this is what you need and thank you in advance :o)
 
Yury Zhukovskiy
Reply

Hi Thomas,

Ecom group pages are different from usual pages by several attributes – “SmallImage”, “LargeImage”. I changed XSLT and check does Page node contains or doesn’t contain «LargeImage”  attribute.

There is work XSLT:

 

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

 

  <!--

  Description: ul/li based navigation. No features from admin implemented.

  Recommended settings:

  Fold out: True or False

  Upper menu: Dynamic or Static

  First level: > 0

  Last level: >= First level

  -->

 

  <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"  encoding="utf-8" />

  <xsl:param name="html-content-type" />

  <xsl:template match="/NavigationTree">

 

    <xsl:if test="count(//Page) > 0">

      <ul>

        <xsl:apply-templates select="Page">

          <xsl:with-param name="depth" select="1"/>

        </xsl:apply-templates>

      </ul>

    </xsl:if>

 

  </xsl:template>

 

  <xsl:template match="//Page">

    <xsl:param name="depth"/>

    <li>

      <a>

        <xsl:attribute name="class">

          <xsl:if test="@InPath='True'">inpath </xsl:if>

          <xsl:if test="position() = 1">firstitem </xsl:if>

          <xsl:if test="position() = count(//Page)">lastitem </xsl:if>

          <xsl:if test="@Active='True'">activeitem</xsl:if>

        </xsl:attribute>

        <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:if test="count(Page)">

       

        <ul class="M{@AbsoluteLevel}_ecom">

          <xsl:apply-templates select="Page[@LargeImage]">

            <xsl:with-param name="depth" select="$depth+1"/>

          </xsl:apply-templates>

        </ul>

 

        <ul class="M{@AbsoluteLevel}_page">

          <xsl:apply-templates select="Page[not(@LargeImage)]">

            <xsl:with-param name="depth" select="$depth+1"/>

          </xsl:apply-templates>

        </ul>

       

      </xsl:if>

    </li>

  </xsl:template>

 

</xsl:stylesheet>

 

 

Kind Regards

 

Zhukovskiy Yury

 
Thomas Nielsen
Reply
Hi Yury,

Thank you for that, i see it is possible :o)

However the kode above produces af output like below:
  • Forside
  • Webshop
    • Køleskabe / Køle-Fryse
    • Kogeplader
    • Ovne
    • Komfurer
    • Frysere
    • Støvsugere
    • Tilbud
    • Varekurv
    • Handelsbetingelser
  • Nyheder
  • Udlejning
  • El-service
  • Butikken
If i change the settings to startlevel:2; i only get the pages
  • Varekurv
  • Handelsbetingelser
What needs to be changed? for the output to look like: http://blaahoejel.net.dynamicweb-cms.com/Webshop.aspx


 
Yury Zhukovskiy
Reply

Try please next xslt. Important sections are marked.

 

 

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

 

  <!--

  Description: ul/li based navigation. No features from admin implemented.

  Recommended settings:

  Fold out: True or False

  Upper menu: Dynamic or Static

  First level: > 0

  Last level: >= First level

  -->

 

  <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"  encoding="utf-8" />

  <xsl:param name="html-content-type" />

  <xsl:template match="/NavigationTree">

 

    <xsl:if test="count(Page[@MenuText = 'Webshop']/Page) > 0">

      <ul>

        <xsl:apply-templates select="Page[@MenuText = 'Webshop']/Page">

          <xsl:with-param name="depth" select="1"/>

        </xsl:apply-templates>

      </ul>

    </xsl:if>

 

  </xsl:template>

 

  <xsl:template match="//Page">

    <xsl:param name="depth"/>

    <li>

      <a>

        <xsl:attribute name="class">

          <xsl:if test="@InPath='True'">inpath </xsl:if>

          <xsl:if test="position() = 1">firstitem </xsl:if>

          <xsl:if test="position() = count(//Page)">lastitem </xsl:if>

          <xsl:if test="@Active='True'">activeitem</xsl:if>

        </xsl:attribute>

        <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:if test="count(Page)">

       

        <ul class="M{@AbsoluteLevel}_ecom">

          <xsl:apply-templates select="Page[@LargeImage]">

            <xsl:with-param name="depth" select="$depth+1"/>

          </xsl:apply-templates>

        </ul>

 

        <ul class="M{@AbsoluteLevel}_page">

          <xsl:apply-templates select="Page[not(@LargeImage)]">

            <xsl:with-param name="depth" select="$depth+1"/>

          </xsl:apply-templates>

        </ul>

       

      </xsl:if>

    </li>

  </xsl:template>

</xsl:stylesheet>

 

 

Kind Regards

Zhukovskiy Yury

 
Thomas Nielsen
Reply
Hi Yury,

Latest xslt stylesheet gives me the 2 pages at top (not bottom) and ecom groups below, also they are in the same UL.
The xslt can also only be used on the specific page of Webshop, as all ecom groups will be shown always - but i can fix that by having this xslt included only on Webshop page.

Thx for all your help, but not quite there yet :-(


 

You must be logged in to post in the forum