Welcome Guest, Not a member yet? Register   Sign In
Help! Handling errors for empty db queries
#2

[eluser]pickupman[/eluser]
At the bottom of your getArticle return FALSE. That way when the URL segment is not found you will have a way to test for it in your controller. Then in your controller if the model returns false, then use show_404() or load a different view or redirect to another page.
As for using the page title in the URL, you can use the URL helper function url_string() to convert it. Similar to WordPress you may want to save the slug in the database. Then lookup the slug rather than the id. Or in your model you could check if the segment is numeric then search by id otherwise search by the slug if it's a string.


Messages In This Thread
Help! Handling errors for empty db queries - by El Forum - 10-06-2012, 04:51 PM
Help! Handling errors for empty db queries - by El Forum - 10-06-2012, 05:17 PM



Theme © iAndrew 2016 - Forum software by © MyBB