Custom "listingsRecord not found!" page
5 posts by 3 authors in: Forums > CMS Builder
Last Post: March 4, 2010 (RSS)
We have a stock list that changes everyday. The database is wiped and then re-populated. What this means is that any products picked up by a search engine will point at a page which no longer exists. This itself is not a problem as the stock turns over so fast that that listing is no longer relevant. However it would be good to get a visitor from the search engine to go to the main product page if the old page no longer exists. At the moment all that is displayed is:
listingsRecord not found!
Any suggestions on the best way to go about this?
Many thanks
8BG
Re: [8bit Gamer] Custom "listingsRecord not found!" page
By gkornbluth - March 3, 2010 - edited: March 3, 2010
You should see some code similar to this in your viewer:
// show error message if no matching record is found
if (!$your_tableRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}
Just change Record not found! to any text you want to appear. I'm not sure how you would include a link or any styling on that message, but I know that you can accomplish that also. If I find out how, I'll revise this post.
Best,
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Re: [gkornbluth] Custom "listingsRecord not found!" page
By Chris - March 3, 2010
// redirect to homepage if no matching record is found
if (!$your_tableRecord) {
header("Location: http://www.mysite.com/");
exit;
}
I hope this helps! Please let me know if you have any questions.
Chris
Re: [chris] Custom "listingsRecord not found!" page
By gkornbluth - March 3, 2010 - edited: March 3, 2010
I guess I should have looked at page 40 in my own cookbook.
Best,
Jerry
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Re: [8bit Gamer] Custom "listingsRecord not found!" page