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 to show ONLY on category blog page.

Module to show ONLY on category blog page.

Hi. I need a module to display ONLY on the category blog page (not in the articles of that category) I searched the forum and did this:

if ($option == "com_content" and $view == "categoryblog" and (int)$category_id == 7 ) return 104; else return;

but I have NO idea of php, and its not working. A programmer charges me 40 usd to do the rule, ad I much rather pay the developer of metamod, if that is needed, THanks!
Sofia

idiel
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: Module to show ONLY on category blog page.

I found it! (did a different search, sorry, I did spend sometime trying things out. ) Just in case  someone needs it:
if ( $option == "com_content" and $view == "category" and (int)$id != XXX and (int)$id != YYY ) return ZZZ;

BUT it does not work on other categories, no idea why. (I copied the module, then I tried doing it from scratch again to no avail.)

Look this code works:
if ( $option == "com_content" and $view == "category" and (int)$id != 7 ) return 104;
on this page (i cannot leave the debug option on, its a live site)
http://victoriamiller.cl/Ecoideas/Reduciendo-Mi-Huella/

THen THIS code, does NOT work:
if ( $option == "com_content" and $view == "category" and (int)$id != 34 ) return 105;
on this page:
http://victoriamiller.cl/Escritos/Cuentos-Juveniles/

This is the debuf info:
MetaMod Cuentos

Page Identification
The PHP code below may be used to help MetaMod to identify the exact page that you are viewing. For help using this feature, please click here.
if (
$option == 'com_content'
and $view == 'category'
and $id == '34'
and $Itemid == 115
and JRequest::getVar('layout') == 'blog' /*!*/
and JRequest::getVar('lang') == 'es' /*!*/
) return XXX; /* replace XXX with the module ID or position to display */
Note: lines starting with "and" and ending with /*!*/ contain rules that may be optional. You may wish to leave them out.
MetaMod debug info:
Module ID: 114
$option: com_content
$view: category
$id: 34
$Itemid: 115
$timezone: UTC
$language: es-es
$language_code: es
$language_region: es
Including modules: Ninguno

I compared both codes, only difference is that the last line does not show the number of the module to be display. (THe module to be displayed exists, its disabled, basically the same as the other.
So, any ideas? please please please?
thanks!

idiel
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: Module to show ONLY on category blog page.

Hi Sofia,

The particular style of rule you are using is EXCLUDING the module from appearing on a particular category page.

e.g.

if ( $option == "com_content" and $view == "category" and (int)$id != 34 ) return 105;

... means "show it on any content category page where it's NOT category 34".

Is that what you wanted?

If you want the module to show ONLY on category 34, then write it like this:

if ( $option == "com_content" and $view == "category" and (int)$id == 34 ) return 105;

(the difference is "== 34" instead of "!= 34")

So then you can have a series of these in a row, that will show you a specific module on each category page:


if ( $option == "com_content" and $view == "category" and (int)$id == 7 ) return 104;
if ( $option == "com_content" and $view == "category" and (int)$id == 34 ) return 105;
if ( $option == "com_content" and $view == "category" and (int)$id == 99 ) return 106;
// etc etc...

Is that what you're after?

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

Re: Module to show ONLY on category blog page.

Hi! thank you for answering!!!
I changer the rule a suggested, but  the module is not showing anywhere.
I HAVE followed all the previous instructions:
Created a module that is set to show on "none" pages,al so tried the metamod-right alternative.
Nothing works. I have no idea what I am missing. sad

idiel
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: Module to show ONLY on category blog page.

Hi Sofia,

Checklist:

1 - MetaMod is published
2 - MetaMod is assigned to a valid module position that appears on the page it's assigned to
3 - MetaMod is assigned to some or all pages
4 - if you turn on debugging mode in the MetaMod, you should see some output in the module position that it's assigned to. If you can't see that, then check steps 1,2,3.
5 - double check the PHP code you are using. If in doubt, paste the EXACT code in the PHP box to the forum here, and I'll take a look at it for you.
6 - ensure that you are using the correct module ids in your "return" statements.

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

Board Info

Board Stats:
 
Total Topics:
1698
Total Polls:
6
Total Posts:
5944
Dormant:
User Info:
 
Total Users:
5595
Newest User:
gary099231
Members Online:
1
Guests Online:
397

Online: 
gary099231

Forum Legend:

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