• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
load different URL

#1
[eluser]Unknown[/eluser]
Hi everyone, just getting started with CI and really liking it so far.

I have a really n00b question:

I've made a custom error handler so I can call an action before a 404 page is shown.

the action at the moment looks something like this.

Code:
function error_404()
{
        echo "<h1>404</h1>";
        
}

would it be possible to call a page based on a url in this function such as

/page/view/1231

without actually doing a redirect to /page/view/1231 ?

so that when the 404 error action is called, it actually shows /page/view/1231

#2
[eluser]wabu[/eluser]
Hello, how about just loading the view you want?

#3
[eluser]designfellow[/eluser]
Hi,

You can do this in two ways.
1. just simply inlcude the view there
Eg. $this->load->view('page');

2. If you want to do some code processing, you can create a custom helper & put the code in a function & call it

I think i'm confusing you a bit.

Option 1 will be easier for you.


Happy Coding,
DesignFellow

#4
[eluser]sophistry[/eluser]
[quote author="ch33ky" date="1253626427"]
would it be possible to call a page based on a url in this function such as

/page/view/1231

without actually doing a redirect to /page/view/1231 ?

so that when the 404 error action is called, it actually shows /page/view/1231[/quote]

then it isn't a 404 is it? it's a 301 or 302 header status code which implies a redirect.

when you send a 404, that means page not found, when you send a default page, that's a default page.

HTH.

cheers.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.