Search

Hi there,

I currently have a data source created, its source is a section that has a select box field that allows the user to select a year followed by subsection manager pulling in a gallery type section (upload field and image cropper), I’m basically just building an image gallery with the entries being represented by a year.

In the data source I’m just trying to filter the output so it will only ever show the entry that has the previous year chosen.

So when selecting ‘year’ to filter by in the data source I have tried using the value of {$this-year -1} but with no luck, I also created a variable <xsl:variable name="last-year" select="$this-year - 1" /> and despite being able to spit the correct year out via the front end of the site when inputting {$last-year} into the filter value field it still don’t work.

Any idea what I’m doing wrong folks?

Many thanks.

Yep; first of all trying xslt variables won't work simply because the datasources are executed before any xslt.

Scondly curly braces are only for variables in filter so {$this-year -1} will not work. you could try {$this-year}-1 however if you're matching strings it won't quite work. if its a date-field on the other-hand yes.

Never had quite that scenario so cannot think of a quick-solution off-hand. if you don't mind getting your hands dirty in php it would be easy to do for-sure but there might be a simpler way of going about it.

Thanks for the reply gunglien, after your reply I was hopeful {$this-year}-1 may have sorted it but unfortunately not, hum...

Select Box Link fields look for a string value as a handle or value to match the linked entries, and a numeric value to match the linked entries by ID.

If you provide a year as a parameter for a SBL, whether you do math on it or not, it will try and reference an ID.

So, sadly, while you can link to a numeric value by SBL, you can't filter that value; It must have some non-numeric character, like a date field. Using a date field to link to is a better option as date filtering would yield more abilities for filtering anyway.

Thanks for the info designermonkey, will have a play.

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