Hi,
I have a website where I publish articles. On the sub-page of a single article, I wanted to add a slider with links to the next articles. I am using pdoResources for this. Items are sorted by menuindex. And now the question, is it possible to easily set in pdoResources to make the slider show links only to the next articles?
Let’s say there are 20 articles on a page and the slider will have 5 elements.
Example 1: Page 1 article, so the slider will show items: 2,3,4,5,6
Example 2: Page 10 article, so the slider will shows items: 11,12,13,14,15
Example 3: Page 17 article, so the slider will show items: 18,19,20,1,2
My current code: [[!pdoResources? &parents=[[*parent]] &resources=-[[*id]] &tpl=tpl_slider &limit=10 &depth=0 &sortby={“menuindex”:“ASC”}]]
This solution is OK for the initial items (articles), but e.g. for item (article) 17 it only shows items 18,19,20 and is missing 1, 2 (i.e. from the beginning of the list) to display the whole slider (5 items). Do you have any idea how to solve th
Hi,
I have written a snippet which does what I wanted, i.e. it selects the next resources and if the next elements are missing up to the set limit, it replenishes the previous ones. Maybe it will be useful for someone.
Name of the snippet: nextIdResources, which must have the parameter: id and may have:limit, sortby, order.
For example: [[!nextIdResources? &id='[[*id]]' &limit='10']]
This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.