make CustomError use a custom page.tpl.php?
ceejayoz - July 17, 2007 - 13:06
| Project: | CustomError |
| Version: | 5.x-1.1 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Is it possible to make CustomError use a custom page template, ala page-customerror.tpl.php?

#1
would be very nice :)
was coming here in the issues section with he hope of finding such an info...
pht3k
#2
I have not tired, but it should work in principle.
In the template.php file of your theme, add the following function:
function phptemplate_customerror($error_code = 404, $content = NULL) {
return _phptemplate_callback('customerror', array('error_code' => $error_code, 'content' => $content));
}
Then create a customerror.tpl.php and put in it what you want.
Not sure if it will do what you want, but worth a try.
#3
hi,
well i was asking because i wanted back the columns drupal 5.1 removed from the error pages, and i just found here how to do this:
http://drupal.org/node/129762
but thanks for your reply; it is some info i was seeking for an other issue...
pht3k
#4
What @kbahey mentioned in #2 in Drupal 6 would be:
function phptemplate_customerror($error_code = 404, $content = NULL) {return theme_render_template('sites/all/themes/afd/customerror.tpl.php', array('error_code' => $error_code, 'content' => $content));
}
#5
Hi,
I have just tried your function but doesn't work. What's wrong, any idea?
K.B.
#6
In
function phptemplate_customerror($error_code = 404, $content = NULL) {return theme_render_template('sites/all/themes/afd/customerror.tpl.php', array('error_code' => $error_code, 'content' => $content));
}
You have to change the word "afd", for the name of your theme, and then place in your theme folder the file customerror.tpl.php with the template in the way you want you custom error to appear.
#7
Better than hard coding the theme path, you can do:
<?phpfunction phptemplate_customerror($error_code = 404, $content = NULL) {
return theme_render_template(base_path() . path_to_theme() . '/customerror.tpl.php', array('error_code' => $error_code, 'content' => $content));
}
?>
The code will be more portable this way.
#8
@kbahey Thanks! that did the job!
#9
Even I create empty customerror.tpl.php file or leave only
print $contentline in the file all default page areas (header, content, footer) are still loaded.So, I guess that this code doesn't help me to change the way 404 page will be displayed. Am I right?
Thanks for all answers.