Search

Lovely alliteration. I was just thinking, the navigation data source can now be filtered by the parent page with all the very useful filter options. But then I realized that the $parent-page parameter is no longer available. Is it possible to bring it back?

It will be returning. I see this has already been noted in the bug tracker.

Yes, I already posted this bug report some days ago. Allen replied that it's just an omission.

For the moment, I'm making do by adding my own $parent-page parameter into the page template, like this:

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

<xsl:import href="../utilities/default.xsl"/>

<xsl:param name="parent-page" select="'brands'"/>
<xsl:param name="current-path" select="concat($root,'/',$parent-page,'/',$current-page,'/')"/>

<xsl:template match="data">
  <h2>
    <a href="{$current-path}"><xsl:value-of select="$page-title"/></a>
  </h2>
</xsl:template>

</xsl:stylesheet>

Then, I can create my navigation menus with the following navigation.xsl utility:

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

<xsl:template match="navigation">
  <xsl:apply-templates select="page[not(types/type = 'hidden')]"/>
</xsl:template>

<xsl:template match="page">
  <li>
    <xsl:if test="@handle = $current-page or @handle = $parent-page">
      <xsl:attribute name="class">current</xsl:attribute>
    </xsl:if>
    <a href="{$root}/{@handle}/">
      <xsl:value-of select="name"/>
    </a>
  </li>
</xsl:template>

<xsl:template match="page/page">
  <li>
    <xsl:choose>
      <xsl:when test="$parent-page = ''">
        <a href="{$root}/{$current-page}/{@handle}/">
          <xsl:value-of select="name"/>
        </a>
      </xsl:when>
      <xsl:otherwise>
        <xsl:if test="@handle = $current-page">
          <xsl:attribute name="class">current</xsl:attribute>
        </xsl:if>
        <a href="{$root}/{$parent-page}/{@handle}/">
          <xsl:value-of select="name"/>
        </a>
      </xsl:otherwise>
    </xsl:choose>
  </li>
</xsl:template>

<xsl:template name="secondary-navigation">
  <xsl:choose>
    <xsl:when test="$parent-page = ''">
      <xsl:apply-templates select="data/navigation/page[@handle=$current-page]/page"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:apply-templates select="data/navigation/page[@handle=$parent-page]/page"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

</xsl:stylesheet>

bauhouse, are you trying to create a nested navigation with sub pages/links?

No, these two navigation lists are separate rather than nested.

I'm trying to use this with Breadcrumbs type of effect. However $parent-path is showing up as blank in my debug params.

How do we create nested navigation then based on the parent page?

The structure I am looking for is:

<ul>
     <li>nav
           <ul><li>sub nav</li></ul>
    </li>
</ul>

Anyone got any ideas?

Nope?

Normally I would just add in a sub section and not bother with Parent params but the sub sections are going to have sub sections too.

Look at this post where I explain how to create a link page with multiple categories and subcategories. Some changes are necessary to adapt it to your navigation data source, but it will show you the basics.

thanks

No problem, if you run into any problems just post them here.

I’m unclear if I’m dealing with a continuation of the bug mentioned above or if I’m not doing something right (given that it’s still my rookie season with Symphony).

I’m running a Ninja multiple domain setup for a real-estate client. I have been following the tutorial on designprojectx.com by Michael Eichelsdörfer. I have created a page called affiliates which is supposed to be a child page of the home page called lardner-group. Here’s the screenshot:

Screen Shot

parent-page is set to show in the xml and yet I see nothing in the entry or the parameters. Here’s the entry xml within the navigation node:

navigation node xml

Where should I be looking?

@wjnielsen: Welcome, Braveheart! (If this is your rookie season, you are brave to try this!) :-)

How far have you followed the tutorial? Are you talking about a single-directory installation or a multi-directory installation? Are the .htaccess rules in place?

What exactly are you looking for in your XML? If .htaccess rules are done, it should be up and running.

Please try and post as precisely as possible, opening a new thread.

Maybe I’m missing something but what relevance does the Data Source XML have to page parameters? What type of field is the “Navigation” field?

Excuse the amount of posts of me recently. I believe my question is relevant to this thread since it is exactly Bauhause's: why is there no {$parent-page} param? (there is a {$parent-path}…)

Michael-e mentions a bugreport (gone or moved) and the fact that it was probably an omission. Has this bug been fixed?

I'm coming back to Symphony after some time and can't get something simple as 'getting the parent page' to work :-(

@davidhund, I'm not entirely familiar with what you are trying to achieve, but $parent-page was deprecated some time ago in favour of $root-page. Is that the parameter you are looking for?

Bauhause, thanks. What I am trying to achieve is simple: "Get all Page Content entries that have {$PARENT-OF-CURRENT-PAGE} set as their page"

I've seen {$root-page} but, since there is a {$parent-path} param, I assume(d) {$root-page} was the top-most page in the current 'branch', not necessarily the exact parent of the current page. If the latter is the case, this is exactly what I was looking for.

Hmm. You're right. The $root-page param is the root page rather than the parent page. So, that doesn't help in your case. I wonder if an extension could be created to add a $parent-page parameter to the parameter pool (although it certainly would be useful to have in the core).

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