Change blocks depending on the module

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Change blocks depending on the module
Rizzen
CZ Newbie
Rizzen has been a member for over 10 year's 10 Year Member
Status: Offline
Joined: Feb 03, 2008
0.00 posts per day
Posts: 16
Points: 10
   
Is there a way to change lets say the left side blocks based on what module is being viewed. For instance someone is looking at a page in the content module, I would like a block that appears on the left that only shows them links I have created for other content pages, and no other block. However I also do not want this block to be visible in any other module.

Heres what I have tried so far:

I have added the statement if (defined('INDEX_FILE')) { above the blocks("left"); statement. so now my left side blocks do not show up on anything unless i put define('INDEX_FILE', true); into the module.

I also went into the blocks.php and created a left2 option for block position and gave it a $bposition value of "a". Now how do I get the module to call the blocks with $bposition=a only.

I tried adding if defined($index==2) { blocks("left2"); into the theme.php and adding $index=2; to the module but it doesn't call it.

To top it off I can find where blocks("left") is defined so it may not know what blocks("left2") is supposed to be.

If I am going about this all wrong and anyone has a way to accomplish my goal it would be much appreciated.

Thanks in advance.



Back to top Reply with quote
#2   re: Change blocks depending on the module
Rizzen
CZ Newbie
Rizzen has been a member for over 10 year's 10 Year Member
Status: Offline
Joined: Feb 03, 2008
0.00 posts per day
Posts: 16
Points: 10
   
Actually in digging around I was thinking that calling it from another file within the module might be easier. The same way the news module calls the Article rating box and etc. but I have NO idea how that works either......bah im so confused now.



Back to top Reply with quote
#3   
Telli
Site Admin
Telli has been a member for over 14 year's 14 Year Member
Occupation: Self Employed
Age: 40
Fav. Sports Team: Detroit Red Wings
Website: www.codezhost.com
Status: Offline
Joined: May 26, 2003
1.48 posts per day
Posts: 8090
Points: 494,325
   
Easiest way to add it would be in your theme.php. Just above the blocks("left"); add this code:


global $name;
if ($name == 'Content') {
     echo "Your menu code here";
}
blocks("left");




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#4   re: Change blocks depending on the module
Rizzen
CZ Newbie
Rizzen has been a member for over 10 year's 10 Year Member
Status: Offline
Joined: Feb 03, 2008
0.00 posts per day
Posts: 16
Points: 10
   
OK, thank you very much that did work however it does not place it correctly. It places it above the content instead of to the left of it. How do I fix that?



Back to top Reply with quote
#5   
Telli
Site Admin
Telli has been a member for over 14 year's 14 Year Member
Occupation: Self Employed
Age: 40
Fav. Sports Team: Detroit Red Wings
Website: www.codezhost.com
Status: Offline
Joined: May 26, 2003
1.48 posts per day
Posts: 8090
Points: 494,325
   
Try putting all your HTML for the menu into a variable:


$mymenuhtml = 'My menu html';


Then try adding this into your theme:


themesidebox('Menu Name', $mymenuhtml);


If you get a function does not exist error then you may have to move that function so it is above the function themeheader();



_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#6   re: Change blocks depending on the module
Rizzen
CZ Newbie
Rizzen has been a member for over 10 year's 10 Year Member
Status: Offline
Joined: Feb 03, 2008
0.00 posts per day
Posts: 16
Points: 10
   
That works also to call the menu but it is still placinging it above the content instead of next to it. I defined my html as $mymenuhtml and just placed it over function themeheader(); since that part is just defining the variable I don't think it matters where that goes but maybe I am putting the other part in the wrong place. Heres what I have:

global $name;
if ($name == 'Content') {
themesidebox('Menu Name', $mymenuhtml);



just above

if (defined('INDEX_FILE')) {
   blocks(left);



Back to top Reply with quote
#7   
Telli
Site Admin
Telli has been a member for over 14 year's 14 Year Member
Occupation: Self Employed
Age: 40
Fav. Sports Team: Detroit Red Wings
Website: www.codezhost.com
Status: Offline
Joined: May 26, 2003
1.48 posts per day
Posts: 8090
Points: 494,325
   
Just for testing purposes try adding it under the blocks("left"); also add a few bits of text just above your blocks("left"); and see where that shows up.

Is this a standard Nuke install and Nuke theme your using? I just tested on my Nuke 8.0 testing site and it worked fine for me.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#8   re: Change blocks depending on the module
Rizzen
CZ Newbie
Rizzen has been a member for over 10 year's 10 Year Member
Status: Offline
Joined: Feb 03, 2008
0.00 posts per day
Posts: 16
Points: 10
   
Just as an update I was able to get it working but I had to define a new themesidebox function (function themesidebox1) to do it. Wether thats right or wrong at this point doesn't really matter to me. It's working the way I want it to and thats all that matters.

Thanks for all you help. I would never have figured this ou on my own.



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum