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.

 

Recipe help for displaying menu for one category of articles

Recipe help for displaying menu for one category of articles

I'd like to display mod_mainmenu (ID=1) for one category, ID=460. I found the recipe on your site and altered it to fit my needs:

Code:

$category_id = null;

if ( $option == "com_content" ) {
  if ( $view == "category" ) {
   /* category list pages (blog or list style) */
   $category_id = (int)$id;
  } else if (array_key_exists("catid",$_REQUEST)) {
   /* if the category id is in the URL */
   $category_id = (int)JRequest::getInt("catid",0);
  }
  if ( $category_id === null && $view == "article" ) {
   /* if it's an article page without the catid mentioned in the url */
   $nullDate = $db->Quote($db->getNullDate());
   $my_id = $db->getEscaped((int)$id);
   $query = "SELECT  title,  id,  catid "
       . " FROM #__content WHERE id = '$my_id' AND state = 1"
       . " AND ( publish_up = " .  $nullDate
       . " OR publish_up <= CURRENT_TIMESTAMP )"
       . " AND ( publish_down = " . $nullDate
       . " OR publish_down >= CURRENT_TIMESTAMP  )";
   $db->setQuery( $query, 0, 1 );
   $row = $db->loadObject();
   $category_id = $row->catid;
  }
}
/* Now customise any of the following rules for your use.
* $category_id will correspond to the category id of the
* article being displayed (if one is being displayed!)
*/
if ($category_id == 460) return 1;/* on category 460, return module 1 */

I must have something wrong though because if you go to one of the pages that's in that category, no menu appears in the left column:

http://www.redkitecreative.com/projects … ocked.html

In mod_metamod I have the menu selection as 'None' and it is published in the left position. I'm using Joomla 1.5.14 and MetaMod 1.5j, can you help me out?

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

Re: Recipe help for displaying menu for one category of articles

Hi Kanjigirl,

You mentioned that you have the Menu Selection as "none" in MetaMod - that's the problem.

Set Menu Selection to "none" in the module you are including, not in MetaMod! The MetaMod has to be set up as a fully published module in the normal way, but the module you are including has to be set to "none" so that it doesn't show up by itself, only when it's included by the MetaMod.

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: Recipe help for displaying menu for one category of articles

Okay - I get it. Thanks. I've got it working now. Very nice module!

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

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5909
Total Posts Today:
1
User Info:
 
Total Users:
10075
Newest User:
rsker57
Members Online:
0
Guests Online:
265

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