Search

A new XSLT utility, “Recursive Navigation” is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.

Great utility, however I was wondering why you were using for-each and call-template if they could’ve been combined into a single apply-templates statement.

Secondly, I’ve learned the hard way that comparing Page handles does not work properly if there are two pages with the same handle but different parents. I encourage you to compare page id’s instead.

Oh, and what does it do differently from Multilevel Navigation? :-)

Recursive Navigation updated to version 0.11 on 6th of August 2010

Recursive Navigation updated to version 0.12 on 31st of August 2010

Recursive Navigation updated to version 0.13 on 24th of September 2010

updated some minor stupidity by changing the $root-parameter to $root-url (not realising in the first place that $root was already used by Sympony itself).

It took me a while to find out what exactly I didn’t like about the call-template approach you were taking: If you were using apply-templates I could create my own templates that hook into page[@handle = 'blog'] whereas your approach makes it nearly impossible to overload the template to match my own needs.

wooo?you are really amzoning

Recursive Navigation updated to version 0.2 on 4th of March 2011

  • Switch from a call-template-approach to a apply-templates-approach, because the call-template-approach was just too flaky... (hey, whay did you expect, it was my first XSLT utility! ;-))

Recursive Navigation updated to version 0.3 on 16th of April 2011

  • Added classes like sub-1, sub-2, etc... to sub-navigation levels
  • Added functionality to override link-generation for specific cases

LOL. Nice addition :-P

Hi,

1) when i try your navigation ... than i get on the frontend the navigation + some content text.... is this a bug ?

2) is there a option to show only a subnavigation ? something linke this.

start level 1 stop level 1

Hey Giel, how would I go about targetting a sub level only in a template without showing the parent level in the tree? i.e:

<xsl:apply-templates select="navigation/page" mode="navigation">
  <xsl:with-param name="levels" select="0" />
  <xsl:with-param name="sub-level" select="1" />
  <xsl:with-param name="root-url" select="$root-page" />
</xsl:apply-templates>

This gives me the root navigation and the child pages.. but I just want to display the child pages of the current page.. any thoughts?

Hah.. just read post above.. dumb ass(me).. that's what I'm after as well..

EDIT could you just expose the "sub-level" param and then allow it to be able to filter on this in templates? overriding the root-url param doesn't seem to work for me on a 2.2.1 install.

Or maybe a param called "start-level" like I've used in a few smarty based CMS's - trying to think of the logic for negating those pages above the currently desired level though.. anyone?

Ehm, I might be misunderstanding your question, but you could do this with XSLT. For example, if your parent page is ID=12:

<ul>
    <xsl:apply-templates select="navigation/page[@id=12]/page" mode="navigation" />
</ul>

I believe the page's ID is even provided as a page parameter.

Ahhh cool.. to clarify.. would this approach list the child pages of the page id selected in the xslt?

Also I'm using multilingual field, if that's gonna make any difference?

On a side note do you have a repo for multilingual fork of search index?

EDIT

Just did what you suggested and all seems ok.. i.e it outputs the children of my Page ID.. but the $root-url is not taking the current page tree into consideration.. i.e I have a page called "Clubs" and child pages of "Clubs" are "Mens, Womens, Juniors, Petanque and Running" and I see these pages as expected in the Outputed page. But the Links to the pages don't have the page parent "clubs" in the url structure so the pages are never found..

i.e "http://localhost/quins/clubs" is my page but each url for the "mens, womens pages" looks like this using the Recursive nav: "http://localhost/quins/mens" or "http://localhost/quins/womens".. see clubs isn't included in the url.. is it just a case of overriding the $root-url param?

Yes, just override the $root-url-param (to concat($root,'/quins/clubs') for example).

Thanks Giel.. all good :) this site is flying now woop!

Hey Giel, is there scope to add a starting level to the utitlity?

as mentioned above. I'm using the root-url param, but that's only useful for the links as far as I can see.

What if I wanted a list of the child pages only? is there a slicker way it could be done rather than hard coding page Id's

perhaps (for all the children of the current page):

<ul>
    <xsl:apply-templates select="navigation/page[@id=$current-page-id]/page" mode="navigation" />
</ul>

or (for all the children pages, don't know why you want to use that):

<ul>
    <xsl:apply-templates select="navigation/page/page" mode="navigation" />
</ul>

What is the goal you are trying to achieve?

Limiting the output on the page in a master template to only show the child pages of a child page. make sense?

First snippet looks like it might be useful.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details