Search

I realize this is probably an extremely basic question. But, yeah… I'm also extremely new to both Symphony and XSLT, so please bear with me. Anyway, my problem is that I can't seem to figure out how to publish articles from specific categories in different locations on the same page.

Say, for instance, that I would like to split my page into two columns and then have one of them display articles from Category 1 while the other one is only picking up articles from Category 2 and so on… How exactly would this be done?

I've been scanning through the documentation, forums and what not for a while now without any luck… So if anything I'm starting to become very well aware of that I probably haven't fully understood the basic concept behind all this yet…

This is a pretty open-ended question but here is one way you could do it:

Assuming your XML structure looks like this:

<data>
    <articles>
        <entry>
            <title>My first article</title>
            <category>
                <item handle="announcement">Announcement</item>
            </category>
        </entry>
        <entry>
            <title>My other article</title>
            <category>
                <item handle="design">Design</item>
            </category>
        </entry>
    </articles>
</data>

One way to achieve split columns based on categories would be:

<xsl:template match="data">
    <div id="articles">
        <div class="column-1">
            <xsl:apply-templates select="articles/entry[category/item/@handle = 'announcement']"/>
        </div>
        <div class="column-2">
            <xsl:apply-templates select="articles/entry[category/item/@handle = 'design']"/>
        </div>
    </div>
</xsl:template>

<xsl:template match="articles/entry">
    <!-- Your article markup here -->
</xsl:template>

There are more advanced and abstract ways to achieve the same thing, but first things first!

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