Clan Adverts

How To Have Diffrent Left And Right Blocks

Description: This tutorial will show you how to have diffrent left/right blocks in your theme.
Version: 1.0
Added on: 30 May 2006
Author: Admin
Difficulty Level: Intermediate
Views: 738
Detailed Profile

I know not everyone wants those boring blocks on both sides of their phpnuke themes. I am here to save the day :) This tutorial will show you how to have different block for the right and left blocks.

Steps :
This is strictly theme based so all editing will be inside the theme's folder.

First you need to create two block files. One for the right [rblocks.html] and the other for the left [lblocks.html]. So you now have your cool blocks, it's time to tell nuke that the right block should be shown on the right and the left blocks to show on the left.

Don't worry, it's actually very simple.
Open themes/YOUR_THEME/themes.php and search for the following line of codes.

Code:
blocks(left);


Change it to

Code:
global $swapleftright;
$swapleftright = "1";
blocks(left);
$swapleftright = "0";


Find your side block function which is usually at the bottom of the theme.php file. It should look similar to the following:

Code:
function themesidebox($title, $content) {
$tmpl_file = "themes/themename/blocks.html";
$thefile = implode("", file($tmpl_file));
$thefile = addslashes($thefile);
$thefile = '$r_file='".$thefile."';";
eval($thefile);
print $r_file;
}


Replace the entire function with this one:

Code:
function themesidebox($title, $content) {
global $swapleftright;
if ($swapleftright=="0") {
$tmpl_file = "themes/themename/rblocks.html"; //link to the right block
} else {
$tmpl_file = "themes/themename/lblocks.html"; //Link to the left block
} $thefile = implode("", file($tmpl_file));
$thefile = addslashes($thefile);
$thefile = '$r_file='".$thefile."';";
eval($thefile);
print $r_file;
}


That's it. Save your file and you should now have different blocks on either side of your phpnuke portal.