Search

Hi all,

I've just recently started playing around with Symphony and I'm really enjoying the flexibility it offers. I do wish there was a bit more documentation but that's another story! Anyway I've started a fresh install with none of the default pages, data-sources and utilities and I'm trying to rebuild all these myself by referring to the default install so that I actually understand what's going on under the hood. One of the things I'd like to do is change the way the blog works a bit – by default you're shown the latest blog post on your homepage and then you can click through to www.yoursite.com/articles/article-name, but if you go to www.yoursite.com/articles your shown a 404 error page. I'd like to make the articles page show the last 10 or so posts in shortened versions which can be clicked through to the main article.

I've achieved this by creating my articles page – which I've called 'blog' and checking the URL to tell me if it's on an article or on the main blog page with:

    <xsl:choose>

    <xsl:when test="$blog=''">

        <xsl:call-template name="blog-list"/>

    </xsl:when>

    <xsl:otherwise>

        <xsl:call-template name="blog-detail"/>

    </xsl:otherwise>

    </xsl:choose>

This seems to work but what worries me is that because this is using the same page and data-source will it be a huge demand on the system to pull in all that XML as more and more blog posts are added? I don't really know enough about how it works behind the scenes to tell. Is there another more streamlined way to do this? I saw this blog post which looked interesting http://chaoticpattern.com/article/symphony-2-preview-url-parameters/ and I wondered if that might provide a solution – but to be honest I'm not entirely sure how to implement it. Anyway if anyone could shine any light on the matter I'd greatly appreciate it.

Hi Ben,

What you want to do should be possible. Take a look at the Articles data source. In the default install it has "Redirect to 404 page when no results are found" checked, which you should uncheck, and make the "Required URL Parameter" field blank too. Also change "Show a maximum of [1] results" to 10 results, then take a look at www.yoursite.com/articles/?debug and compare it with www.yoursite.com/articles/some-article-name/?debug.

Filters on the data source form have a special way of working to allow this. Since the "Title" field's filter value is {$entry}, this might evaluate to "" (the empty string) when $entry is not set in the URL. Instead of finding all entries whose title is blank, Symphony will skip this filter rule like it never existed, and will just grab the first 10 entries whose "Published" checkbox is checked, ordered by descending date (or whatever you've chosen in the Sort By/Sort Order fields below).

Hi Scott,

I see what you mean, I'm not sure how it's doing it but at least it works! Thanks for your help.

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