Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.


danielbidala
Beginner Modder
ranks
useravatar
User Info

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 21:49:27

Administrator has disabled public posting
metamodguy
useravatar
User Info

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

Administrator has disabled public posting
danielbidala
Beginner Modder
ranks
useravatar
User Info

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?


Administrator has disabled public posting
metamodguy
useravatar
User Info

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

Administrator has disabled public posting

Board Info

Board Stats:   Total Users: 3079  Total Topics: 1195  Total Polls: 7  Total Posts: 4448  Posts this week: 18
User Info:   Newest User :  raisaalam   Members Online: 1   Guests Online: 107
Online 
raisaalam
Topic
New
Locked
Topic
New
Locked
Sticky
Active
New/Active
Sticky
Active
New/Active
New/Closed
New Sticky
Closed/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky Active Locked
Active/Sticky
Sticky/Locked
Sticky/Active/Locked