4 users online. Create an account or sign in to join them.Users

Search

I know its possible to sort via XSL, but that breaks down when using pagination. Is it possible to use a URL parameter to change which field is sorted on?

It looks like according to the last Symphony update, you can change the order ASC or DESC based on URL parameters, so that’s cool. Just wondering if changing the sort field would also be possible?

I think if you customise the DS you can. For exampe you may have:

public $dsParamSORT = 'system:id';

Change to:

public $dsParamSORT = '{$url-sort-field}';

And you should be able to filter on /page/?sort-field=title. Just remember that if you save your DS through the editor, your customisation will be lost.

Cool! Thanks a bunch! Now I don’t have to duplicate all of my code and make separate datasources! Will try it out soon.

One follow-up question though, how might I choose the default field to sort on if no URL parameter exists?

DS filters use a colon to specify a fallback, so you could try it here.

{$url-sort-field:title}

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.2 or above
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.0 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details