For some esoteric reason, you may want to hide the column with the left blocks, although it contains some crucial blocks, like the modules block (Figure 17-1), for example. To accomplish this, you have to edit the themeheader() function in the theme.php file of your theme (in the
themes/YourTheme folder) and replace the line:
with
if ($name=='Forums') {
/* Don't display it. */
}
else {
blocks(left);
}
|
Here, we check if the module is the Forums module and suppress the call to blocks(left) if it is. This will hide the left column blocks in the Forums. It is easy to include more modules, as in the
following example (see Hide left blocks when viewing Forum or ANY module, Como eliminar los bloques de la izquierda, Left Blocks on Index Page only):
if ($name=='Forums' || $name=='Members_List' || $name=='Private_Messages') {
/* Don't display it. */
} else {
blocks(left);
}
|
Don't forget to add $name to the list of global variables in themeheader():
global $user, $banners, $sitename, $slogan, $cookie, $prefix, $dbi, $name;
|
Of course, if you don't find the call to blocks(left), your theme already suppresses the left column of blocks. 
 |
How to hide the right blocks |
|
Most of the time, if you want to hide any blocks, they will be the blocks in the right column, not the blocks in the left. See Section 18.1.1 on how to hide
the right blocks.
|
From a theme design point of view, the above solution does not look satisfactory: you have to hardcode the names of the modules that should not display the left blocks into the code of the theme.
Since you don't know in advance which ones these are, you create a dependency relation to all existing and future modules.
A cleaner, alternative way is to declare the global $hideleft variable in themeheader() and check its value instead:
global $hideleft;
...
if($hideleft == 1){
/* Don't display it. */
} else {
blocks(left);
}
|
Now, for every module that you want to hide the left blocks, insert the lines
global $hideleft;
$hideleft =1;
|
at the beginning of its code. As you see, with this method, the selection of the modules that hide the left blocks has become the job the modules' authors. The theme code can work with any module,
present or future one, without changes - as any theme should.
 |
More flexibility with the Block Modificator |
|
With Chris Sengers' Simple Blocks Manipulator for left blocks you can
put any block left or right differently with any module. You can even use inactive blocks and also change the theme according to the module (we show how to do this yourself in Section 14.11).
|