Search

Hi, I'm trying to implement a "Next article" button using another datasource and filtering the entries with earlier than {$ds-single-image} and limiting entries to 1.

It works as expected but there is a problem if multiple articles are saved on the same time. Only one of the articles is displayed as next and if I go the the next article it shows the next article the next one that is not saved in the same minute as the actual one. Is there any way to fix this ? Or maybe to add seconds or something else to the date filter ?

To get the idea I'll try to show an example.

I have for example 5 articles: Article 1 (date 1) Article 2 (date 2) Article 3 (date 2) Article 4 (date 2) Article 5 (date 3)

Articles with the same date means the articles are saved into the same minute. The -> sign means if I click next article btn.

Article 1 (date 1) -> Article 4 (date 2) -> Article 3 (date 3)

If I filter by system id, is there any way to filter it something like (bigger than symbol if it exists for filters) > {$ds-single-image} ?

Somehow this behavior is normal as the date must be earlier than not earlier or equal (excluding the current one) but any idea how can I get what I want ?

Thanks !

Using the data source you got, have you tried then grouping the images by article in your XSLT? You would need to use <xsl:key />. Let me know if this is unfamiliar to you and I can elaborate.

Well I'm not familiar with what you suggested but I understood the concept you say to group the images and/or articles. Seems like you didn't understood what I tried to explain. To make it clear, the image is actually added directly to the article content itself with an upload field so the article and the image is comming from the same entry.

I'm trying to make link that points to the next article (you may be confused by the name of the param $ds-single-image, it is called like that because my articles are mainly made to have a image and a small description so I named the datasource Single image). Basically the image or article doesn't matter, I just want to know if there is any other way to make a next article link because the earlier than seems to not work if 2 or more articles are created on the same minute (the date field seems to have seconds too but they always setted to 00 on my xml source)

EDIT : do something like bigger than {$id} on filtering ? I'm thinking to use the system_id instead but they don't come one next to another as I have other types of sections too. So it must be something like : Next bigger/smaller existing entry id from this datasource that exists.

I think it would be ok to have a datasource that outputs the ids of all your entries ordered by date and then grab the preceding with xslt. However, If you have a whole lot of entries and that would affect performance you can maybe add an incremental number field to your section and use that as ds-param and filter.

Also, try to use in your chained datasource the {date} to {date} syntax instead of the earlier than {date} one and see if it makes a difference.

do something like bigger than {$id} on filtering

No matter Articles, Images or whatever, I'm using this method to generate next / prev item.

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