Search

I'm currently trying to get the comments-section working on different sections than articles. A problem I have right now is with the following code in "get-comments.xsl":

<a href="{$root}/symphony/publish/comments/?filter=article:{/data/article/entry/@id}">Manage</a>

This link filters the comments on an article. I like it! But: I have different sections and thus pages with comments. If I want to have the nifty "Manage"-link on all of them, the only sollution I can think of now is to provide a different "get-comments-for-section.xsl" for all of them. Quite redundant.

An other way would be to get the section handle dynamically, like this (pseudocode):

<a href="{$root}/symphony/publish/comments/?filter={$current-section}:{/data/{$current-section}/entry/@id}">Manage</a>

But I have no idea how to achieve this... If the section would correspond with the page title, I could use {$current-page}, but that's not the case. Perhaps I could use an xpath query?

booker

You can find the current section in your data sources. Look for something like this:

 <section id="1" handle="article">Article</section>

How to address the sections for your links depends on your context node.

If I get it right, then the context node is the problem. I call the template from within a page with

<xsl:apply-templates select="comments"/>

, so I'm in the root node of the document.

I have several sections, and so I have several 'section'-nodes. Like this:

<data>
  <intros>
    <section id="16" handle="intros">Intros</section>
    ...
  </intros>
  <gigs>
    <section id="14" handle="gigs">Gigs</section>
    ...
  </gigs>
  ...
</data>

The section child nodes of data are named after the sections - To get the current section out of the xml, I have to know it's name in advance, which I don't.

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