Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Output a 404 error page on next empty pages url?
Hi,
I’m using an infinite scroll button and my problem is that the button is not removed on the last content loading because the function is looking for a 404 error page to remove it but textpattern doesn’t output any error on next empty pages url.
Infinite scroll is configured to die when it hits a 404 Not Found status code, so when it goes through all your archives it should hit a /page/43/ (or something) that doesn’t exist, then show a message “Congrats, you’ve reached the end of the internet.”
$(document).ajaxError(function(e,xhr,opt){if(xhr.status==404)$('a#next').remove();});
Does anyone know how to do?
Thx!
Last edited by NicolasGraph (2013-08-11 15:03:48)
Offline
Re: Output a 404 error page on next empty pages url?
You can configure Infinite Scroll to stop scrolling on any condition of your choice, checking for 404 error being just one of them. Instead of checking for 404 error, you could check whether the requested page has a next page link on it. If not, its the last page. You could also do it by defining maxPage
option. Scrolling itself can be stopped by triggering the pause method.
Now, you can make Textpattern to return 404 error page. The txp_die tag can be used to return 404 pages, and if_search_results tag checks whether the last article tag (yes, it needs to be used after the article tag) returned any results.
<txp:if_search_results>
<txp:else />
<txp:txp_die status="404" />
</txp:if_search_results>
Last edited by Gocom (2013-08-11 19:20:36)
Offline