Welcome Guest, Not a member yet? Register   Sign In
Blog URIs: many different ways to construct them. What did you do?
#11

[eluser]keld[/eluser]
yes I think it does, will try this tonight.

Thanks a lot!

Is you show_404() a custom function? What do you have in it, you load your template with an error message to have a 404 page using your site's design or just the default browser's 404
#12

[eluser]JoostV[/eluser]
show_404() is a default CI function. http://ellislab.com/codeigniter/user-gui...rrors.html

I adjust the 404 template to the look and feel of the site.
#13

[eluser]keld[/eluser]
Great, thanks so much!
#14

[eluser]JoostV[/eluser]
You're welcome Smile
#15

[eluser]keld[/eluser]
Hey so I'm almost there, one question though, when I get a 404 redirect using the show_404() function, I'd like instead to display my own custom 404 page (which will actually be my template file that i use for displaying my regular webpages plus some extra options like links plus a searh field.
So I modified the error_404.php but then I got an error message on 'load' in
Code:
$this->load->view('navigation');
so I guess the 404 pages don't have access to the load class.

I have then created a 404.php view and in my controller did show_404('mc_home_controller/error_404'); because in the documentation is says you can pass the url of the page you to display but I still get the ugly 404 page.

Any advices?

Thanks!
#16

[eluser]keld[/eluser]
I've found some info there http://ellislab.com/forums/viewthread/109430/, it doesn't seem like there's a real solution to it except having some static html in the default 404 page if you don't want to change the url
#17

[eluser]JoostV[/eluser]
That's simple, really. Just don't use show_404();

Instead, send a raw 404 header in your controller before you load the views (make sure you have NO output before you send the header).

Code:
// Fetch post by id or throw 404
if (!$this->data['post'] = $this->posts->get($post_id)) {
    log_message(1, '404 - Post ' . $post_id . ' could not be found');
    set_status_header(404);
    $this->data['subview'] = 'blog_post';
    $this->load->view('main_template', $this->data);
}
#18

[eluser]n0xie[/eluser]
Why not just use:

Code:
example.com/blog/what-an-interesting-blog-post

And use canonical to solve any bad linkage/duplicate content etc etc.
#19

[eluser]keld[/eluser]
[quote author="JoostV" date="1263386070"]

Code:
// Fetch post by id or throw 404
if (!$this->data['post'] = $this->posts->get($post_id)) {
    log_message(1, '404 - Post ' . $post_id . ' could not be found');
    set_status_header(404);
    $this->data['subview'] = 'blog_post';
    $this->load->view('main_template', $this->data);
}
[/quote]

I get a wrong header php error....
#20

[eluser]JoostV[/eluser]
What's the error?
[EDIT] Check to make sure you do not output anything to the browser before setting the header.




Theme © iAndrew 2016 - Forum software by © MyBB