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.

 

Need help with displaying module for a particular category

Need help with displaying module for a particular category

Hi I use metamod pro for a while now, but I have difficulties to show a seperate menu for a particular category.

This is my code:

Code:

if ( MM_LOGGED_IN ) {

   
    if ( JRequest::getVar('task') == 'edit' ) return "";
    else return "24, 39, 21, 40";
   
    if ( $option == 'com_joomla_flash_uploader' ) return "";
    else return "24, 39, 21, 40";

    if ( $option == "com_content" and $view == "article" and JRequest::getInt("catid",0) == '21') return "";
    else return "24, 39, 21, 40"; 
   
}

else return "20, 39, 29"; /* Not logged in users */

Everything is working fine except for the last part with the catid. I am trying to show no modules for a particular category, but when I view the specific page nothing happened. All the modules still showing.

Who can help me with this?

Edited By: JustCarmen
24-Jun-10 10:34:26

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

Re: Need help with displaying module for a particular category

Hi Carmen,

The problem with the code above is that the "else" statements in the part for logged-in users will stop execution passing through to the code below.

Step through the code with me...
... if user is editing, don't return a module,
... else return several modules

So after that line, it's not going to get any further down the rule. If the user is editing, it returns nothing; if user is not editing, the other list of modules is returned. In either case, PHP will go no further down the rule.

So, I would re-organise the rule like this:

Code:

if ( MM_LOGGED_IN ) {

    if ( JRequest::getVar('task') == 'edit' ) return "";
    if ( $option == 'com_joomla_flash_uploader' ) return "";
    if ( $option == "com_content" and $view == "article" and JRequest::getInt("catid",0) == '21') return "";
    return "24, 39, 21, 40"; // these will be returned when not editing, not in flash uploaded, and not an article in category 21
}

else return "20, 39, 29"; /* Not logged in users */

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:
1684
Total Polls:
6
Total Posts:
5940
Posts this week:
1
User Info:
 
Total Users:
5174
Newest User:
frashaomran
Members Online:
0
Guests Online:
115

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