Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Hide module in k2 item view for a specific category

Hide module in k2 item view for a specific category

Hi Mister!

I'd like to hide a module whitin 2 or 3  k2 cetegory's item page. In k2 category view and all other pages it must be displayed, hide only in item view for these specific category's item page. My php knowledge is a bit pure.

I use Joomla 2.5.6 and k2 2.5.7.

Can you help me in this issue? Thanks in advance.

Edited By: danielbidala
09-Jul-12 22:49:27

danielbidala
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: Hide module in k2 item view for a specific category

Hi Daniel,

can you please assign a MetaMod to ALL pages, and turn on the MetaMod's "Advanced debug mode"?

Then, visit some of the pages that you want to show the module on, and some that you want to hide it on, in K2.

The MetaMod will output some PHP code. Please copy and paste that code into the forum here, and explain for each one if that is a page that you want the module on, or to hide it on.

That will help me identify the right PHP code to use for you.

Best regards,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Re: Hide module in k2 item view for a specific category

Hi Stephen!

I was on holiday, but i'm back now. Thank you for your replay. Now, i'm using this peace of code for that:

Code:

if ($option == "com_k2" and $view == "item") {

  $db->setQuery( "select catid from #__k2_items where id = " . ( (int) $id ) );
  $catid = $db->loadResult();
  if ( $catid == 28 ) return false;
  if ( $catid == 31 ) return false;
}
return 389;

Maybe it's not too elegant solution but it works for me. What's your opinion? Is there an esier way?

danielbidala
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: Hide module in k2 item view for a specific category

Hi Daniel,

I think this will be the easiest solution UNLESS the category id is put into the URL in some way (though hidden in SEF URLs). If you use Advanced Debug mode in MetaMod you'll soon see if this is done. Joomla's standard com_content DOES do this, so it's worth checking.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1689
Total Polls:
6
Total Posts:
5941
Posts this week:
1
User Info:
 
Total Users:
5361
Newest User:
scotti64d
Members Online:
1
Guests Online:
166

Online: 
scotti64d

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked