How to get section handles?
This is an open discussion with 2 replies, filed under Troubleshooting.
Search
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.
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":
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):
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