Hi guys,
its me again…
I want to check for the pagination if the prev or the next page of the currently opened page uses a specific template.
I use for a blog different templates e.g. (article.video, article.image, article.quote, article.link).
Two of the templates are article.quote and article.link are not accessible. These two are only shown on the blog overview and not accessible.
The two other templates are accessible and the article is shown if u click on them.
Now i want to implement prev next buttons. I use the code from the the starterkit but if i try to go trough the prev or next buttons it ends in the error when the next or previous page is article.quote or article.link .
Is it possible to check the next or previous page which template is in use? So i can avoid them?
Sry for all the text!
Florian
If i understand your problem correctly, I think the best solution is to filter them out of the set of pages you feed to the pager. You can filter by template, or not having a defined template.
Check out this solution: Navigate into a collection with hasNext/hasPrev
By default, you can’t pass a collection to the prev()
and next()
methods.
The filter by template might be a good idea. Thanks i will try something out tomorrow.
Thanks I will also check out this solution.
I will let you know what works for me 
By default, you can’t pass a collection to the prev()
and next()
methods, therefore filtering alone will not really help you. You can, however, use the methods in the solution I linked to above, and then pass a filtered collection to it.
This is different from using the pagination object which works with a (filtered) collection.
@texnixe OK i look if i can fix my problem, i already played a bit around with your solution but it might take me while
Thank you!
If you need any help with getting this to work, don’t hesitate to ask.
1 Like