Support Forums | Demo Gallery [1.x] [2.x] | Downloads | News | Site Map ]
Nuked Gallery
  Create a FREE account or Login   As a guest, you don't have access to our FULL navigation system.
 Forum FAQForum FAQ   StatisticsStatistics   SearchSearch   UsergroupsUsergroups   FavoritesFavorites  

Displaying/hiding Blocks

 
Post new topic   Reply to topic    NukedGallery.net Forum Index » PHP-Nuke Integration » Other PHPNuke Issues View previous topicPrinter friendly versionView next topic
Author Message
naomi

Beginner
Beginner


Joined: Dec 16, 2004
Posts: 1

PostPosted: Thu Dec 16, 2004 4:21 am    Post subject: Displaying/hiding Blocks Reply with quote

Hi there,

I'm fairly new to phpnuke, and am wrestling with it, trying to get it to behave the way I want it to.

My major issue at the moment is with blocks. In a nutshell, I want some pages to display some blocks and not others.

In my research, I have learned the nifty code:

Code: › global $name;
    if($name!=Forums)
    {
    blocks(left);
    }


This works well for hiding ALL blocks on the left side in a specific module, eg the Forums.

But what If I wanted to hide just one of the blocks on the left side?

My question is, how does PHPNuke display the blocks, what is the function that calls the blocks?

In mainfile I've found the blocks($side) function. This refers to a whole side however, not a specific block.

In my primitive coding mind, it seems logic that if you can refer to a blocks position in php code, surely you should be able to refer to a blocks' title, or individual ID number.

So we have the $title variable, all blocks have a unique value here. How can I use $title in a similar fashion to how the $name variable is used, and write some php code that does this:

If (viewing forums)
Display (search_block, login_block, forummenu_block)
else
If(viewing indexpage)
Display (mainmenu)

Surely this is possible?

Any help is appreciated, if you'd like me to explain further no problems.


Edit:

After a bit more research I've gotten this far by myself:

Code: ›     global $name;
  if($name!=Content)
{
include("blocks/block-Sample_Block.php"); 
echo "$content";

}


This works, except it doesnt display the block properly, with its title, colours and size etc, it just displays whatever I have placed in the content variable.

How do I make it display the block properly, whats the function call, cause echoing content isnt enough?
Back to top
Offline View user's profile Send private message
AdBot
   Post subject: Displaying/hiding Blocks  

Back to top
NUOPhil

Beginner
Beginner


Joined: Dec 17, 2004
Posts: 1

PostPosted: Fri Dec 17, 2004 5:28 pm    Post subject: Re: Displaying/hiding Blocks Reply with quote

In simple words to do this all you have to do is go to your Admin and go to Modules then find the module you want and go all the way to the right and do what you want. Wink Hope it helps.
Back to top
Offline View user's profile Send private message
xperiment

Beginner
Beginner


Joined: Dec 04, 2003
Posts: 19
Location: Upstate NY

PostPosted: Thu Mar 09, 2006 11:22 am    Post subject: Re: Displaying/hiding Blocks Reply with quote

That won't do what he wants, that'll load a module in the center block on the main page - he's talking blocks not modules, there is a difference.

There IS a good way to do this, I've done it before and need to again - can someone please refresh my memory?

To refresh the question, I want the Sidebar Block to appear only when the Gallery2 module is loaded, what do I do?

Thanks!
Back to top
Offline View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
dari

Site Admin
Site Admin


Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA

PostPosted: Thu Mar 09, 2006 11:34 am    Post subject: Re: Displaying/hiding Blocks Reply with quote

check the name of the currently loaded module, if it's your g2 module, don't display the block (this is done in your theme.php file)
Back to top
Offline View user's profile Send private message Visit poster's website
xperiment

Beginner
Beginner


Joined: Dec 04, 2003
Posts: 19
Location: Upstate NY

PostPosted: Thu Mar 09, 2006 11:57 am    Post subject: Re: Displaying/hiding Blocks Reply with quote

i don't get it - I don't understand how this can be done in the theme.php file - if I do what I think you're speaking of, it'll turn OFF all left blocks when I access the module specified.

Last time I had it working well, I added a loop to mainfile.php - I just don't remember exactly what it was.
Back to top
Offline View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
dari

Site Admin
Site Admin


Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA

PostPosted: Thu Mar 09, 2006 12:10 pm    Post subject: Re: Displaying/hiding Blocks Reply with quote

in your theme.php file should be a function called "sideblocks" or something like that. simply check the current $module_name and the block name, if the module name isn't your g2 module, don't display the g2 sidebar.

give me 15 minutes and i'll post a sample.
Back to top
Offline View user's profile Send private message Visit poster's website
xperiment

Beginner
Beginner


Joined: Dec 04, 2003
Posts: 19
Location: Upstate NY

PostPosted: Thu Mar 09, 2006 12:16 pm    Post subject: Re: Displaying/hiding Blocks Reply with quote

OK thanks dari I'll give it a shot, I've never done anything like this in the theme.php file before
Back to top
Offline View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
dari

Site Admin
Site Admin


Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA

PostPosted: Thu Mar 09, 2006 12:28 pm    Post subject: Re: Displaying/hiding Blocks Reply with quote

look for the themesidebox function.
after the function declaration, put:
PHP: › <?php global $module_name?>


then, add:
PHP: › <?php if($title == "<g2_sidebar_title>") {
    if(
$module_name !== "gallery2") {
        return;
    }
?>
Back to top
Offline View user's profile Send private message Visit poster's website
xperiment

Beginner
Beginner


Joined: Dec 04, 2003
Posts: 19
Location: Upstate NY

PostPosted: Thu Mar 09, 2006 2:03 pm    Post subject: Re: Displaying/hiding Blocks Reply with quote

You're awesome, works great - and much simpler than the path I was heading down Smile
Back to top
Offline View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    NukedGallery.net Forum Index » PHP-Nuke Integration » Other PHPNuke Issues View previous topicPrinter friendly versionView next 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
All times are GMT - 5 Hours

Powered by phpBB © phpBB Group



Sponsors: Dedicated ServersDomain NamesWeb HostingDomain Name RegistrationDedicated Web HostingWeb Design New YorkCompare VoIPseo packagesSEO CompanyNew York Yellow PagesFind LocationsVOIP Phone ServiceNeckermannOnline internetSEORestaurant Locator • Get great HP coupons from CouponSnapshot • Search for great dell coupons at CouponSnapshot.com.au • Graduation DressesAndroid TabletSEO IndiaBuy Phen375fuel filter

8th year online! 2003-2011
Legal • Use of this site consitutes agreement to the Acceptable Use Policy
Hosted by Implosion WorksSourceForge.net Logo • Theme by TonicMedia