Welcome Guest, Not a member yet? Register   Sign In
Problem with custom 404 page :(
#1

[eluser]victorche[/eluser]
Hi @all!

I really need a custom 404 page, as the one provided with CI does not allow enough customisation. For my needs I am using the solution, described here:

http://codeigniter.com/wiki/Custom_404_error_pages/

It works really nice and gentle. But because I am a newbie, maybe there is something as logic in general, which I can not understand.

The problem is, let's say... I have /products page, where all my products are listed. Every product has a short description and a button "view details". This link is leading to /products/detail/product_id, for example /products/detail/23

So I have a products.php in application/controllers/... It has function index(), which makes the product list with /views/products_tpl.php
But in products.php I am adding function detail() which is taking care for the single product page. It is using /views/product_details_tpl.php
For example, if I have url like this: /products/detail/23
I am getting the product_id and then details from the table like this:
Code:
$id = $this->uri->segment(3);
$this->db->where('id', $id);
Everything works fine, except the 404 page Sad
Here is the problem, explaned:
if I have products/ -> This is products list, works and displays correct;
if I have products/detail/23 -> This is the details page of a single product, and if I have a row with id = 23, it works fine...
if I have /products/detail/werxcgwet -> Here I want 404, but I only have a blank page
if I have /products/detail/23457656723454576 -> Id, which is numeric but does not exist in the database... again blank page

I know that it is normal, I mean the logic is like this, but how can I make something like... If the product ID does not exist... this custom 404 to be used?


Messages In This Thread
Problem with custom 404 page :( - by El Forum - 07-12-2010, 01:09 AM
Problem with custom 404 page :( - by El Forum - 07-12-2010, 01:19 AM
Problem with custom 404 page :( - by El Forum - 07-12-2010, 01:22 AM
Problem with custom 404 page :( - by El Forum - 07-12-2010, 01:27 AM
Problem with custom 404 page :( - by El Forum - 07-12-2010, 01:42 AM
Problem with custom 404 page :( - by El Forum - 07-12-2010, 02:03 AM
Problem with custom 404 page :( - by El Forum - 07-12-2010, 03:21 AM
Problem with custom 404 page :( - by El Forum - 07-12-2010, 03:29 AM
Problem with custom 404 page :( - by El Forum - 07-12-2010, 03:38 AM
Problem with custom 404 page :( - by El Forum - 07-12-2010, 05:47 AM
Problem with custom 404 page :( - by El Forum - 07-12-2010, 06:04 AM
Problem with custom 404 page :( - by El Forum - 07-12-2010, 06:59 AM
Problem with custom 404 page :( - by El Forum - 07-12-2010, 07:07 AM
Problem with custom 404 page :( - by El Forum - 07-12-2010, 07:15 AM
Problem with custom 404 page :( - by El Forum - 07-12-2010, 08:18 AM
Problem with custom 404 page :( - by El Forum - 07-13-2010, 01:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB