PHPJavascript

Web Development Guide – My Personal Library of Tutorials and Scripts

Drupal 404 403 errors theme regions missing

July4

When using the error reporting feature of drupal I faced my theme getting screwed up, the regions and block of left side went missing. After searching drupal posts etc I found the following solution for drupal 6:

Add the following function in your theme’s template.php file:

Click here to find a solution for drupal 5

<?php
/**
* Override or insert PHPTemplate variables into the templates.
*/
function phptemplate_preprocess_page(&$vars) {
// handy helper for themes, not related to 404 issue
$vars['base_path'] = base_path();

// Only does the check if required
if(!$vars['show_blocks']) {
global
$theme;
$regions = system_region_list($theme);
foreach (
array_keys($regions) as $region) {
// Only set left and right regions
// Drupal core sets the other blocks already
// IMHO this shows a real lack of design considerations for leaving these out!
if ($region == 'left' || $region == 'right') {
$blocks = theme('blocks', $region);
if(isset(
$variables[$region])) {
$vars[$region] .= $blocks;
}
else {
$vars[$region] = $blocks;
}
}
}
}
}
?>

posted under Drupal

Email will not be published

Website example

Your Comment:

 

12,958 spam comments
blocked by
Akismet