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.

 

[solved] Want to hide modules on specific template template

[solved] Want to hide modules on specific template template

Hi

Using Joomla 2.5.1  Metamod 3.15    Chameleon 2.36 

My need is pretty simple.  I am using Chameleon to deliver templates mainly based on URL.   And when Chameleon is displaying a certain template named "musicwideinterior" I want NO module to show in a certain position.  The template "musicwideinterior" only shows on certain pages.   And whenever that template shows I want the module not to show. I don't want ANY module to show in that position for that template.

BTW I also have advancedmodulemanager pro, but I would prefer to do this via metamod -- if that makes sense!

Below is a recipe I put in the PHP tab -- I assume that is where it should go.  It is all that I put in on that tab.  Nothing else.

$mainframe =& JFactory::getApplication();
$template =& $mainframe->getTemplate();
if ($template == "musicwideinterior") return 101; /* on this template, use module 101 */

However using the above code still shows the module in the template.   Should I remove the "return 101" -- since I don't want ANY module to show in that position when using the musicwide interior template.

I have the module set up per the quick setup using "Alternative using Module Positions instead of IDs".

BTW all of my templates use the same position names.

Yes, it's pretty basic, but clearly I am doing something wrong.

Thanks!

Rowby

Edited By: metamodguy
30-Dec-13 22:51:22

rowby
Junior Modder
ranks
useravatar
Offline
24 Posts
User info in posts
Administrator has disabled public posting

Re: [solved] Want to hide modules on specific template template

Hello

Here is a screen capture of my specific issue. 

http://rowbytesting.com/metamod-article … gories.jpg

If I set metamod to show for article ID's and put in the article ID's it works.

But if I set modamod to show for a CATEGORY and select the category (Category List), it does not work -- for me. 

Thanks,

Rowby

rowby
Junior Modder
ranks
useravatar
Offline
24 Posts
User info in posts
Administrator has disabled public posting

Re: [solved] Want to hide modules on specific template template

Hi Rowby,

In asnwer to your 1st post in the thread, I'd set it up like this:

1 - for sake of argument I'll call the position that you want to NOT display "left".
2 - reassign all the modules that were in the "left" position into a position called "left-not-wide-interior". Now there are no modules in "left".
3 - create a MetaMod in the "left" module position
4 - name the MetaMod anything you like, perhaps "Show modules in left except on musicwideinterior"
5 - Assign the MetaMod to ALL menu items and ensure it is published.
6 - in the PHP box in the MetaMod, use the following:

$mainframe = JFactory::getApplication();
$template = $mainframe->getTemplate();
if ($template != "musicwideinterior") return "left-not-wide-interior";

7 - do not put anything into the "quick module id or position include" box. Leave it empty.
8 - save the MetaMod, and test.

That should do it.

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

Re: [solved] Want to hide modules on specific template template

Regarding your 2nd post: from the screenshot, I see you are using Chameleon to enter the article ids or categories. But you're talking about MetaMod, so I am a little confused.

Try doing what I wrote in the last post and if you have any trouble with it please write back.

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: [solved] Want to hide modules on specific template template

HI Stephen,

Your post "fixed" it. 

I had everything correct on my own except for the following ommissions which you corrected for me:

My php was incorrect
I had it as
$mainframe =& JFactory::getApplication();
$template =& $mainframe->getTemplate();
if ($template == "musicwideinterior") return 101; /* on this template, use module 101 */

It should have been:
$mainframe =& JFactory::getApplication();
$template =& $mainframe->getTemplate();
if ($template == "musicwideinterior") return medamod-music-position7;

FYI "medamod-music-position7" was the pseudo position I created for the medmod module referencing the actual module which needed to be in my template's "position7".)

Also I switched from advancedmodule manager to the core module manager and made sure that in Menu Assignment I had "Module Assignment" set to "On All Pages".

That did it.  (Keeping fingers crossed).

Clearly it was my mishandling of the php statement, above all, that caused my method not to work.

Thanks!

Rowby

rowby
Junior Modder
ranks
useravatar
Offline
24 Posts
User info in posts
Administrator has disabled public posting

Re: [solved] Want to hide modules on specific template template

Hi Rowby,

I'm glad that worked!

Just 1 syntax correction. Instead of this:

if ($template == "musicwideinterior") return medamod-music-position7;

use this:

if ($template == "musicwideinterior") return "medamod-music-position7";

PHP will often survive without the quotes, but strictly it's an error to leave them out.

Best regards,
and Happy New Year,
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

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5909
Posts this week:
1
User Info:
 
Total Users:
10121
Newest User:
brian01731
Members Online:
4
Guests Online:
282


Forum Legend:

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