Search

Hello, I'm working on a site that uses Symphony as the CMS. I'm on a page that pulls in "entries". Each of the "entries" use the same "section" code. Hopefully I'm getting my Symphony terminology correct.

Anyway, I need to add anchor links to the top of the page which link to the different "entries" further down the page. Is this possible? I know how to do it outside of Symphony using regular HTML, but I can't add a 'name=""' to the "section" code cause that would apply the name to all the entries. I'm thinking if there is a generic entry handle code that I could use, something like this "{embed-url}"?

Any help would be great.

Thank you!

try a for-each

<xsl:for-each select="entry">
<a href="{name/@handle}>add the xslvalue-of name</a>
</xsl:for-each>

and below add the <a name="{entry/name/@handle}>

But there are no handles for entries. Unless I'm mistaken. If you know please shed some light.

Thank you.

Entries have no handle but you can use as a handle the one of a field output within the very same entry, as jeffleeder suggested.

Assuming your XML is similar to:

<my-section>
    <entry>
        <name handle=“something” >Something</name>
        […]
    </entry>
    <entry>
        <name handle=“something-else” >Something Else</name>
        […]
    </entry>
</my-section>

you can create a very simple menu at the top of your page:

<xsl:template match="my-section" mode="menu">
    <ul>
        <xsl:apply-templates select="entry" mode="menu"/>
    </ul>
</xsl:template>

<xsl:template match="entry" mode="menu">
    <li>
        <a href="#{name/@handle}">
            <xsl:value-of select="name"/>
        </a>
    </li>
</xsl:template>

and when you output the contents of each entry you just need to add an id to their container:

<xsl:template match="my-section">
    <xsl:apply-templates select="entry"/>
</xsl:template>

<xsl:template match="entry">
    <div id="{name/@handle}">

        […]

    </div>
</xsl:template>

Otherwise you can do something similar using the id of each entry (keeping in mind that, since the id cannot be a mere number, you have to add some text before it):

<xsl:template match="my-section">
    <xsl:apply-templates select="entry"/>
</xsl:template>

<xsl:template match="entry">
    <div id="some-text-{@id}">

        […]

    </div>
</xsl:template>

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