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.

 

Module not showing

Module not showing

I want a menu to display to all articles in a category. I've used the code provided here

http://www.metamodpro.com/support/recip … e-category

It's set to the right category, there is articles in that category and it's enabled - but when I go to one of the articles in the category I can't see the module.

Is there anything else int hat code that needs modifying other than the pages that part that says 'null'

Thanks

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

Re: Module not showing

Hi Craven2,

when customising the recipe on that page, please note the following:

1 - don't change the first line! (i.e. don't change null to the category id you want to target)
2 - DO change the last 4 lines. The ones in the recipe are this, but you need to change them for your setup:

if ($category_id == 1) return 55;/* on category 1, return module 55 */
if ($category_id == 2) return 56;/* on category 2, return module 56 */
if ($category_id == 3) return 57;/* on category 3, return module 57 */
return 50; /* default if nothing else matches */

... so if you just have 1 category that you want to target with 1 module, just use a single line like this:

if ($category_id == 1) return 55;

(replace "1" with the category id, and "55" with the module id).

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

Re: Module not showing

Hmm, tried that there and al though that makes a lot more sense it still doesn't appear to be doing the job. This is the code I'm using, to display module 69 for all articles in category 19 - could you tell me if it's correct?

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->Quote( $db->getEscaped( (int)$id ) );
   $jnow  =& JFactory::getDate();
   $now    = $db->Quote( $db->getEscaped( $jnow->toMySQL() ) );
   $query = "SELECT  title,  id,  catid "
       . " FROM #__content WHERE id = $my_id AND state = 1"
       . " AND ( publish_up = $nullDate "
       . " OR publish_up <= $now )"
       . " AND ( publish_down = $nullDate "
       . " OR publish_down >= $now  )";
   $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 == 19) return 69;

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

Re: Module not showing

Hi craven2,

What are you actually seeing, or not? Is the problem that you're not seeing the target module on *any* pages, or that you're seeing it on all of them? Or some of them?

Are you following all the instructions in http://www.metamodpro.com/get-started/quick-start ?


Specifically:

1 - the MetaMod has to be enabled.
2 - If it's not set to display on ALL pages, the MetaMod must be assigned to the correct/relevant menu items

If you're not seeing it on any of them, then try enabling MetaMod Debug mode. If you have the MetaMod assigned to the right pages, you should see some debug output on every page that the MetaMod is assigned to, and it should indicate which pages it would actually place the target module onto. ("included modules: number").

It's probably just a minor setup thing at this point.

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
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:
190

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