Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Hide module in k2 item view for a...
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.
09-Jul-12 21:49:27
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
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?
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
- Index
- » MetaMod
- » MetaMod General Support
- » Hide module in k2 item view for a...
Board Info
- Board Stats:
- Total Topics:
- 1699
- Total Polls:
- 6
- Total Posts:
- 5965
- Posts this week:
- 4
- User Info:
- Total Users:
- 8011
- Newest User:
- ignac84502
- Members Online:
- 0
- Guests Online:
- 274
- Online:
- There are no members online
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked