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 a module only on category page and not in articles

Display a module only on category page and not in articles

Hello i would like to show a module only on category page and not on the articles of that category, is that possible with this module?
If yes, could you please provide me the code for this thing?
Thanks in advance

I'm using joomla 1.6

Edited By: meme12
09-Jul-11 06:19:25

meme12
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Re: Display a module only on category page and not in articles

Hi Meme12,

yes, that's easy:

1 - create the target module and set it to "none" menu items
2 - create the MetaMod and set it to "all" menu items. Make sure it's published.
3 - in the MetaMod, turn off the title display
4 - in the MetaMod, use the following PHP rule:

if ($core_genius->check("pagetype startswith categor")) return XXX;
// replace XXX with the module id of the target module.

I use "startswith categor" because then it will appear on "category" pages, "categoryblog" pages, and also the full "categories" page that lists all categories.

Hope that helps,
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 a module only on category page and not in articles

Hello Stephen,

This is an old thread but the closest I could find to my question:
Basically the same question as above, only now for K2 articles.

I want a module to apear on the frontpage and the category view (news), but not on the actual news-articles.

I am no coder, but I am confident in working with already created code. How would I go about doing this with metamod? It seems a quite powerfull mod, being able to execute php, so I'm a little carefull and don't want to deploy it untill I know what I'm doing, so I'ld like to ask before I try.

kind regards,

Frank

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

Re: Display a module only on category page and not in articles

Hi Frank,

Can you please tell me the version of K2 and version of Joomla you are using?

Basically however the easiest way to detect a certain type of page is in most cases to install MetaMod, create a MetaMod module, and switch on MetaMod's "advanced debug" mode. Then view the page that you want to target on the front end of your site. The MetaMod will give you some PHP code. If you're confident with a little PHP you can use that (with some modifications if necessary) as your PHP code in MetaMod. If not, just paste the output from there into a forum reply and I'll take a look at it 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
3312 Posts
User info in posts
Administrator has disabled public posting

Re: Display a module only on category page and not in articles

Hi Stephen,

Of course :-) I'm on Joomla 2.5.7 and also K2 2.5.7 as far as the info goes. Keeping all updated to the latest versions.

Ok, I would like to follow your advice, but I'm a bit weary, bk it seems to me (without using it) the metamod is a powerfull beast, and I would hate to ruin anything on site now, bk we just went live with the new site on www.crystalvenue.nl. However, I'm willing to follow your instructions. Maybe not today, but in the next two or three days.

kind regards,
Frank

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

Board Info

Board Stats:
 
Total Topics:
1666
Total Polls:
6
Total Posts:
5909
Dormant:
User Info:
 
Total Users:
10091
Newest User:
lamanaudio
Members Online:
3
Guests Online:
181


Forum Legend:

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