» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Online Users: 56
0 members and 56 guests
No Members online
Most users ever online was 611, 03-21-2008 at 11:10 PM.
» .::.
Web Hosting - web hosting, dedicated servers and web design services
Online Degree - search for 1000+ online degrees, online colleges & online universities.
Tattoo - we are a group of tattoo enthusiasts
Gexa Energy - your absolute best choice in electric service
Texas electricity - save on electric rates
Football Betting - best nfl betting promotions at sportsbook.com.
Oral Chelation - initial cleansing of your veins & arteries
Portatiles - Ofertas en Ordenadores y Portatiles. Increibles Ofertas DELL.

Register Now! Contact Us

About this Page
This is a discussion on Code Hack: Diff Block Layout For Right & Left Blocks within the Site design forums, part of the General category; One thing I have noticed is that just about every nuke site out there has matching left and right blocks, ...


Go Back   Nukemods Forum » General » Site design

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-29-2004, 04:12 PM
Junior Member
 
Join Date: Jun 2003
Posts: 7
Code Hack: Diff Block Layout For Right & Left Blocks
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>&middot;</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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-29-2004, 04:34 PM
Moderator
 
Join Date: Nov 2002
Location: Belgium
Posts: 957
hi audioslave,
you really seem to have no luck with this coding stuff => mtechnik made such a different blocks right and left tutorial already a long time ago :? but none of the less it is great work! I never bothered to create diffrent styles, but I think it is nice after what I saw on that test site. One of the next portedmods site designs will have different blocks
__________________
Yannick R. aka Mighty_Y
http://support.code-area51.com
http://www.code-area51.com

Search before asking makes my life easier!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-29-2004, 04:39 PM
Junior Member
 
Join Date: Jun 2003
Posts: 7
Dude!
Everyone has done everything already!!! AHHHHHHH! **runs away and slams door!**

Damn it all! LOL!

Hey, I tried, I was going to put a disclaimer on this one too! Should have known something already existed like this, oh well, I do what I do and can only hope it inspires others to learn or at least brings them a smile because they know I wasted my time when it was already done

Its there a searchable kb that has what has been done so I can stop looking like an arse!

nonetheless, I have the first discography module in the world though! Ahahahaha **slams door again**

That too is on the test site
http://test.audioslaved.com/modules....me=Discography

-Bill (Audioslaved)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-29-2004, 04:51 PM
Moderator
 
Join Date: Nov 2002
Location: Belgium
Posts: 957
Just wanted to inform you , next time you want to do something ask me first :P , I have the same feeling: not everything has doen yet, but you just don't find anything that needs to be done before someone else does it

Yup that's the first discography module I've ever seen, and I like it alot => good job on that one

PS http://test.audioslaved.com/article-category-1.html seems to be some kind of bug :?
__________________
Yannick R. aka Mighty_Y
http://support.code-area51.com
http://www.code-area51.com

Search before asking makes my life easier!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-29-2004, 04:59 PM
Junior Member
 
Join Date: Jun 2003
Posts: 7
no doubt, that is a bug LOL!

That site is on 3/4 php sessions, still working out the kinks, since that site is modded so heavily, incorporating the sessions architecture is more of a pain than just rewriting the files with those I have gt.audioslaved.com (site has php sessions integrated on everything but surveys).

I will definitely be sure to ask you from now on!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 07-09-2004, 02:14 AM
Junior Member
 
Join Date: Jul 2004
Posts: 3
first of all nice work audioslave

I do step by step this mod.
My right blocks are different from left blocks but my articles view more right block is same as left block.

I am using nuke version 7.3

Please help!!!!!!

see my test site here http://inet.mn/index/

the article block page is this http://www.inetmng.com/index/modules...=article&sid=1
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 07-09-2004, 12:01 PM
Moderator
 
Join Date: Nov 2002
Location: Belgium
Posts: 957
http://www.inetmng.com/index/modules...iversal_Module
those blocks there are also the same as the left blocks, and that is just simple => the articles file uses the blocks() function (I think it is called like that) wich takes the layout for the left blocks! If you want to change that, you have to mod your articles.php (or atleast the file where the blocks are outputted)
__________________
Yannick R. aka Mighty_Y
http://support.code-area51.com
http://www.code-area51.com

Search before asking makes my life easier!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 07-10-2004, 06:50 PM
Junior Member
 
Join Date: Jul 2004
Posts: 3
I did not know how to change article and Universal modules blocks around on it couple of weeks pain in the ass

Mighty thanks a lot, i edited the files now it is ok.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
No left blocks after upgrade ??? am-v Nuke 7.x - Blocks 5 12-20-2005 07:26 PM
hide left blocks?? serkan61 Theme packs 5 07-07-2003 05:43 PM
MeG 6.5 how do u remove the left blocks? kenhos22 Nuke 6.5 to 6.9 - Modules 1 05-17-2003 11:16 PM
Changing Layout in blocks Etc.. dds Site design 7 03-13-2003 04:37 PM
Left Blocks PrecisioN Purged Topics 1 12-27-2002 10:05 AM


All times are GMT -5. The time now is 11:56 PM.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31