It looks like you're new here. If you want to get involved, click one of these buttons!
In the current version of vanilla, I can access pages (ie. /P5, /P4) that don't have content, I want to return 404 for those pages. How can I make this?
maybe we can write something that return 404 if the result of the discussions array is empty
I thought about editing the class.discussioncontroller.php where I have the $ActualREsponses and do calculattion against the Comments.PerPage and get the Page number from the URL. For wrong page, return 404 via php. IS there any simpler way to do that?
use hooks. look for a suitable Event in discussions Controller and hook into that event.
$Offset = 0;
$Limit = 10;
$DiscussionModel = new DiscussionModel();
$Sender->DiscussionData = $DiscussionModel->Get($Offset, $Limit, $Whereas);
$CountDiscussions = count($DiscussionModel->Get($Offset, $Limit, $Whereas));
above hook is to display only 10 discussions without pagination as an example.
you will have to look into whole code for discussionscontroller and hook it properly else it will be messed up
Theme Charcha for great desktop and mobile experience! - drop me a message :)
PLEASE EXPLAIN. I can even get to that page by using this URL "http://vanillaforums.org/discussion/18968/how-to-return-404-for-non-existing-pages/p5" ,which is wrong.
Can or cannot ? Forums use a thread id system
This is common, the fancy pants titles are for your benefit.
Reason is, so that you cannot impersonate another user .. And parse diff url to cheat the system. Try typing it in, url that is and change in browser the title words !
422 Real Estate Australia , now open Check it out
How do I get the page number from the URL, the one that shows P5, so I want the number 5 into my variable
That wasnt your original question though, your after pagination.
Dashboard set comments per page
no, of course not, I need it for the code that I'm building, so I can check the data against the URL page number
this is the funniest one yet @422. Thx for the comic relief. Its an oldie but a goodie, and perhaps the funniest reponse I've seen on the forum.
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
Wonder why someone* marked it as abuse !
I see what the op is saying here. It would make for a cleaner experience. I would consider it low priority though since.
Crawlers are highly unlikely to crawl off the end of the page list since there are no links.
Returning a 404 error may make crawlers come back to the page less often which is bad for when there really is content.
This is exactly the kind of feature that pull requests are made for though ;)