{h1: Powerful navigation in {em: Symphony CMS}} Most of the time creating a menu for your site is easy, but what if you want a little more control? In this tutorial, I'll show you how to reclaim your sites navigation. {h1: The concept} First things first, I'm going to pretend I'm building a simple blog like site, with just three major pages -- {em: Home}, {em: Blog}, and {em: Portfolio}. Our navigation system must do at least {em: two things}: {ol: {li: It must flag the current page in the navigation so that users know where they are} {li: It must give us control over when, and when not to, show navigation items} } How can we achieve this? It's easy enough, if you define your navigation as XML inside an XSLT utility then you can use the data sources and parameters available on that very page to change your definition: {pre.language-xsl: } Basically, we've built a string that contains XML, but not in a way XSLT can use. So we need to define a new parameter, and use EXSLT to transform out string into an XSLT node-set: {pre.language-xsl: } Now we need to add a mechanism to identify pages -- add the following to each of your pages, replacing home with the Id you gave the page in your XML definition: {pre.language-xsl: } Then add a fallback parameter to the navigation utility: {pre.language-xsl: } Once you've done all that, it's time to think about rendering your navigation, I'm going to go with a simple ordered list: {pre.language-xsl:
  1. Home
  2. ...
} So, now add a template to the utility that can be called to render your menu on the page: {pre.language-xsl:
} And then add a utility to render each item in the format you want: {pre.language-xsl:
  • active
  • } To finish it all off, include the navigation utility in your master template, then call it: {pre.language-xsl: } {h1: The utility} For easy copy and pasting, here's the full utility: {pre.language-xsl:
  • active
  • } That should be all you need to create awesome dynamic menus, but if you have any suggestions or thoughts, don't be afraid to let me know.