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.

 

Display module on K2 items but not category list.

Display module on K2 items but not category list.

I have a module displaying successfully on K2 item pages for a category, but I don't want the actual category itemlist page to show the module, as the module is an item based self referencing thing, on non-item pages it just shows a blank area where the module is loaded but no data.

I use this php code to get the module on item pages:

if ($option == "com_k2" and $view == "item") {
  $db->setQuery( "select catid from #__k2_items where id = " . ( (int) $id ) );
  $catid = $db->loadResult();
  if ( $catid == 26 ) return 99 ; // for category XXX, use module YYY
}


How would I add to this code so that the module - 99 - does not display for catid - 26 - when in itemlist (category) view.

Thanks.

belwaron
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Display module on K2 items but not category list.

I tried ( note second statement ):

if ($option == "com_k2" and $view == "item") {
  $db->setQuery( "select catid from #__k2_items where id = " . ( (int) $id ) );
  $catid = $db->loadResult();
  if ( $catid == 26 ) return 99 ; // for category XXX, use module YYY
}

if ($option == "com_k2" and $view == "itemlist") {
  disable();
}


but that just gives me an error.

belwaron
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Display module on K2 items but not category list.

Hi belwaron,

first of all, the original PHP code you are using (without the 2nd statement) should be enough to prevent the module id (99) from appearing on any other page except for "item" pages and category 26.

So my question is: how is module 99 appearing on the itemlist pages at all? Have you remembered to set it to "none" menu items so that it doesn't show up until the MetaMod includes it?

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
3312 Posts
User info in posts
Administrator has disabled public posting

Re: Display module on K2 items but not category list.

Hi there,

It half works - Module 99 displays on the item pages, on the category pages it's blank. It still takes up the space in the template though - an empty metamod module.  I think it's more of a separate issue than metamod. It might be something to do with my CSS or general template coding,

Thanks anyway,
Bel

belwaron
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Display module on K2 items but not category list.

Please see these FAQs:

http://www.metamodpro.com/metamod/faq/2 … etamod-was
http://www.metamodpro.com/metamod/faq/2 … th-matamod

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
3312 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1666
Total Polls:
6
Total Posts:
5909
Dormant:
User Info:
 
Total Users:
10093
Newest User:
lamanaudio
Members Online:
0
Guests Online:
248

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