Search

I'm trying to set up a document archive with an alphabetic index. The current character is set via the URL, e. g. /documents/a. The document archive should only show entries that start with the selected character.

Is there a simple way to set up the data source editor to filter by the first character or do I have to create a custom DS?

So, regular expressions are your friend. This is the solution I found myself: Set up a data source with the following regexp: regexp:^{$character}. where $character is the URL parameter. As a fallback, this data source returns all entries of the section when $character is not set. If you want to have no entries returned if $character is not set, just use regexp:^{$character}

Can this method provide me with a fallback language? I filter by a global parameter that returns the first 2 letters of the langauge header of the visitors browser…. But if I don’t have an entry in the language of the visitor, It should fallback to a fallback language, ea English.

You could just use the syntax for fallbacks: {$language:en}

http://getsymphony.com/learn/concepts/view/data-source-filters/

I did the same thing - creating an alphabet bar along the top with a button for each letter of the alphabet. What I'd really like to do now is grey out the buttons that contain no entries. So I'm thinking of a data source that iterates through the products and spits out a list of all the unique letters, that I can use to generate my buttons. This is definitely going to have to be a custom DS. Is it possible to do this sort of thing with raw SQL?

When I'm building an alphabetic index, I normally create a static Data Source of the alphabet that I compare with the dynamic results.

I left this problem for a while, but just had to resolve it before signing off the project stage.

Thanks for the pointer @nils, I did go down that route to an extent, but @creativedutchmen kindly provided a MySQL query that does it in one fell swoop.

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