Closed fritzmg closed 2 years ago
Hi Fritz Thank you for the further development! This is cool! Marko
@fritzmg Should we change the minor version, too?
@fritzmg Should we change the minor version, too?
Up to you, I think it can be considered a bugfix but also a new feature to support caching in a more proper way.
If you enable the HTTP cache in your contao installation, issues might occur with the infinite scroll module. For example, if a non-AJAX request is made to a pagination URL (e.g. by a crawler), then that URL will be cached. However, this will cause the AJAX functionality to break, because then the cached response includes the full page and not just the news elements.
Furthermore if you have two newslists on the same page, only the first one will really work.
This PR fixes that and improves some other things as well:
page_nX
query parameter).ajaxCall
query parameter, so that the AJAX response can be cached differently from the regular response (there are different ways to handle this, but this is the easiest).config.php
, since the JavaScript is only necessary where this newslist module is added to a page. And since you are likely not using such a module on most pages, it makes sense to only include the JavaScript when necessary.|static
flag from the JavaScript, since it's now only added on demand.ajaxCall
CSS class. It was actually never added to the module output before. But may be you don't want/need this class anymore anyway? Then it can be removed.Since this PR changes many little things at once, I can also split it up into different PRs, if you want.