One thing I have noticed is that just about every nuke site out there has matching left and right blocks, here is a hack I put together to make right blocks display different content (look, feel, colors, etc) than the left blocks.
I have this method being used on this site
http://test.audioslaved.com
First step is to replace instances of right blocks being processed with a new function, we will call this function themesidebox2(), which will be all but a copy of themesidebox() in your themes theme.php. There will only be a minor difference in the function, but we will get to that later.
Since we know we are dealing with themesidebox2 as our right blocks function we have to do a little hacking in our mainfile.php where the blocks are processed. You would simply replace your existing functions with the following:
Code:
FIND
the whole function (start { to finish }) render_blocks:
REPLACE WITH:
function render_blocks($side, $blockfile, $title, $content, $bid, $url) {
if ($url == "") {
if ($blockfile == "") {
if ($side == "c") {
themecenterbox($title, $content);
} elseif ($side == "d") {
themecenterbox($title, $content);
} elseif ($side == "r") {
themesidebox2($title, $content);
} else {
themesidebox($title, $content);
}
} else {
if ($side == "c") {
blockfileinc($title, $blockfile, 1);
} elseif ($side == "d") {
blockfileinc($title, $blockfile, 1);
} elseif ($side == "r") {
blockfileinc($title, $blockfile, 4);
} else {
blockfileinc($title, $blockfile);
}
}
} else {
if ($side == "c" OR $side == "d") {
headlines($bid,1);
} else {
headlines($bid);
}
}
}
FIND:
the whole function (start { to finish }) blockfileinc:
REPLACE WITH:
function blockfileinc($title, $blockfile, $side=0) {
$blockfiletitle = $title;
$file = @file("blocks/$blockfile");
if (!$file) {
$content = _BLOCKPROBLEM;
} else {
include("blocks/$blockfile");
}
if ($content == "") {
$content = _BLOCKPROBLEM2;
}
if ($side == 1) {
themecenterbox($blockfiletitle, $content);
} elseif ($side == 2) {
themecenterbox($blockfiletitle, $content);
} elseif ($side == 4) {
themesidebox2($blockfiletitle, $content);
} else {
themesidebox($blockfiletitle, $content);
}
}
FIND:
the whole function (start { to finish }) headlines:
REPLACE WITH:
function headlines($bid, $cenbox=0) {
global $prefix, $db;
$bid = intval($bid);
$sql = "SELECT title, content, url, refresh, time FROM ".$prefix."_blocks WHERE bid='$bid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$title = $row[title];
$content = $row[content];
$url = $row[url];
$refresh = $row[refresh];
$otime = $row[time];
$past = time()-$refresh;
if ($otime < $past) {
$btime = time();
$rdf = parse_url($url);
$fp = fsockopen($rdf['host'], 80, $errno, $errstr, 15);
if (!$fp) {
$content = "";
$sql = "UPDATE ".$prefix."_blocks SET content='$content', time='$btime' WHERE bid='$bid'";
$db->sql_query($sql);
$cont = 0;
if ($cenbox == 0) {
themesidebox2($title, $content);
} else {
themecenterbox($title, $content);
}
return;
}
if ($fp) {
if ($rdf['query'] != '')
$rdf['query'] = "?" . $rdf['query'];
fputs($fp, "GET " . $rdf['path'] . $rdf['query'] . " HTTP/1.0\r\n");
fputs($fp, "HOST: " . $rdf['host'] . "\r\n\r\n");
$string = "";
while(!feof($fp)) {
$pagetext = fgets($fp,300);
$string .= chop($pagetext);
}
fputs($fp,"Connection: close\r\n\r\n");
fclose($fp);
$items = explode("</item>",$string);
$content = "<font class=\"content\">";
for ($i=0;$i<10;$i++) {
$link = ereg_replace(".*<link>","",$items[$i]);
$link = ereg_replace("</link>.*","",$link);
$title2 = ereg_replace(".*<title>","",$items[$i]);
$title2 = ereg_replace("</title>.*","",$title2);
$title2 = stripslashes($title2);
if ($items[$i] == "" AND $cont != 1) {
$content = "";
$sql = "UPDATE ".$prefix."_blocks SET content='$content', time='$btime' WHERE bid='$bid'";
$db->sql_query($sql);
$cont = 0;
if ($cenbox == 0) {
themesidebox2($title, $content);
} else {
themecenterbox($title, $content);
}
return;
} else {
if (strcmp($link,$title2) AND $items[$i] != "") {
$cont = 1;
$content .= "<big>·</big><a href=\"$link\" target=\"new\">$title2</a>
\n";
}
}
}
}
$sql = "UPDATE ".$prefix."_blocks SET content='$content', time='$btime' WHERE bid='$bid'";
$db->sql_query($sql);
}
$siteurl = ereg_replace("http://","",$url);
$siteurl = explode("/",$siteurl);
if (($cont == 1) OR ($content != "")) {
$content .= "
<a href=\"http://$siteurl[0]\" target=\"blank\">"._HREADMORE."</a></font>";
} elseif (($cont == 0) OR ($content == "")) {
$content = "<font class=\"content\">"._RSSPROBLEM."</font>";
}
if ($cenbox == 0) {
themesidebox2($title, $content);
} else {
themecenterbox($title, $content);
}
}
SAVE AND DO NOT UPLOAD YET:
Now that that is completed we want to make a clone of our themesidebox function. Just open your theme.php and find your themesidebox function (from start { to finish }) near the bottom of your theme.php. Copy and Paste the duplicate below it, now change the name to themesidebox2.
NOTE: Once you change the code in mainfile.php, you will have to add themesidebox2 to every theme on your site. If you wish for your right blocks to be left alone for a particular theme (i.e. look the same as your left), then simply make themesidebox2 and leave it alone (do not do the changes indicated below). It will keep your right blocks looking as they are now.
Making your new right blocks is fairly easy so the next step for you to do is to find this line in your new themesidebox2 function:
Code:
$tmpl_file = "themes/Your_Theme/blocks.html";
Change this to
Code:
$tmpl_file = "themes/Your_Theme/blocks2.html";
Since we are now pointing to a file that does not exist, we have to create that file, copy your existing blocks.html (in you theme/Your_Theme folder) and make another one called blocks2.html. Inside of this file hack away and make some custom right-handed blocks, the rest is up to you
NOTE: In themes where the right and left blocks match do not change the above line to reflect blocks2.html, leave it as blocks.html, if you fail to do this, you will receive an error and I will laugh at you

(Just kidding of course

)
OK there you have it, if you run into problems along the way, let me know, I am here to help you my friends. If you have questions on anything you saw at test.audioslaved.com please feel free to email me and I will look into helping you out though I am under some time constraint. Take it easy all!
-Bill (Audioslaved)