Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » Hide all module with exceptions when...
Hide all module with exceptions when a string is called
Hide all module with exceptions when a string is called
Hi Stephen,
Is there a way to hide all module when a string is called? I also would like to include module exceptions in this exclusion.
I am asking this because on some pages I have more than 8 modules and the only way to exclude a module from a page is to have a menu item and use the joomla core function to exclude that menu item in the module parameters.
This would be much more easier and work for pages that do not have a menu item attached to it.
My string looks like this: /index.php?option=com_rsform&Itemid=582
Cheers,
Alex
Re: Hide all module with exceptions when a string is called
Hi Alex,
there's no facility in MetaMod to hide ALL modules. As you know, normally in MetaMod you selectively *include* modules on all pages where you want them, rather than removing them from the pages where you don't want them. It ends up with the same result but it's just a different way of looking at it.
However... with MetaMod Pro you can actually *remove* modules from a page rather than selectively including them.
You can do it like this:
if ( condition here... ) {
$changes->mod( XXX )->disable();
$changes->mod( YYY )->disable();
$changes->mod( ZZZ )->disable();
// etc.
}
The modules XXX, YYY, ZZZ can be in any module position on the page, not just the ones included in the current MetaMod.
NB. this only works in MetaMod Pro!
Hope that helps,
Stephen
Re: Hide all module with exceptions when a string is called
OK I tried something but I think I have the variable wrong. Futhermore, it would be better if my condition would be a "if url contains" instead of "if url equals".
By the way, I am trying this coding in a metamodpro that is included in the disable condition, would that be a problem?
Code:
if ($url == "http://www.quebecguitare.com/index.php?option=com_rsform&Itemid=582" ) {
$changes->mod( 307 )->disable();
$changes->mod( 404 )->disable();
$changes->mod( 273 )->disable();
$changes->mod( 310 )->disable();
$changes->mod( 396 )->disable();
$changes->mod( 430 )->disable();
$changes->mod( 411 )->disable();
$changes->mod( 311 )->disable();
$changes->mod( 308 )->disable();
$changes->mod( 309 )->disable();
$changes->mod( 151 )->disable();
$changes->mod( 178 )->disable();
$changes->mod( 312 )->disable();
$changes->mod( 315 )->disable();
$changes->mod( 314 )->disable();
$changes->mod( 316 )->disable();
$changes->mod( 353 )->disable();
$changes->mod( 435 )->disable();
$changes->mod( 436 )->disable();
$changes->mod( 457 )->disable();
$changes->mod( 253 )->disable();
}
Please remember, the condition I need is "if url contains", because I have more than one domain leading to the same page.
Cheers.
Re: Hide all module with exceptions when a string is called
Hi Alex,
you can do this with JomGenius... check out the JomGenius documentation on this site to find all the cool stuff you can do with it! In this case, doing "contains" or "ends with".
e.g.
if ($core_genius->check("url ends with index.php?option=com_rsform&Itemid=582")) {
// etc.
I think that should work ok.
Cheers,
Stephen
Re: Hide all module with exceptions when a string is called
Doesn't work unfortunatly. I'm pasting that code in the PHP field in metamodpro. The module I am pasting the code in is one listed in the disable list.
Nothing happens, no errors nothing in advanced diagnostics mode,.
Here's all the code I am using. Maybe theres a conflict I didn't see:
Code:
$mainframe =& JFactory::getApplication();
$template =& $mainframe->getTemplate();
if ($template == "electric_standard_jan2011") return "1";
if ($template == "femmes_jan2011") return "1";
/*if ($template == "flamencofusion_internationnal_jan2011") return "1";*/
/*if ($template == "leadguitar_internationnal_jan2011") return "1"; */
if ($template == "metal_jan2011") return "1";
if ($template == "jw_clean_pro") return "1";
/* Bypass qg_sep2010_3 */
/* if ($template == "qg_sept2010_3") return "1"; */
if ($core_genius->check("url ends with /index.php?option=com_rsform&Itemid=582")) {
$changes->mod( 307 )->disable();
$changes->mod( 404 )->disable();
$changes->mod( 273 )->disable();
$changes->mod( 310 )->disable();
$changes->mod( 396 )->disable();
$changes->mod( 430 )->disable();
$changes->mod( 411 )->disable();
$changes->mod( 311 )->disable();
$changes->mod( 308 )->disable();
$changes->mod( 309 )->disable();
$changes->mod( 151 )->disable();
$changes->mod( 178 )->disable();
$changes->mod( 312 )->disable();
$changes->mod( 315 )->disable();
$changes->mod( 314 )->disable();
$changes->mod( 316 )->disable();
$changes->mod( 353 )->disable();
$changes->mod( 435 )->disable();
$changes->mod( 436 )->disable();
$changes->mod( 457 )->disable();
$changes->mod( 253 )->disable();
}
Re: Hide all module with exceptions when a string is called
Just checking: is there any chance that PHP is not even getting to the URL check, because some of the earlier rules are firing first (and returning a value)?
I think that's likely. Therefore you could move then entire "if ($core_genius->check..." block to the start of the rule, before any of the checks are done for the other templates.
Remember, if it ever hits a "return" statement, then nothing after that gets run.
Cheers,
Stephen
Re: Hide all module with exceptions when a string is called
OK I did the change. There was actually 2 problems:
The first one that you've mentioned; the order of the condition. I made sure it was put before everything else, including all return command.
Second, I was calling metamod IDs rather than the original source module. For example, my main menu ID is "1" and the metamod for this module is "311". I was calling "311" instead of "1".
Here's the code on top of every other conditions... did a slight change in the condition and removed unrelated modules to that page, instead of including the whole bunch I had prior to the change:
Code:
if ($core_genius->check("url contains rsform")) {
$changes->mod( 1 )->disable();
$changes->mod( 229 )->disable();
$changes->mod( 228 )->disable();
$changes->mod( 173 )->disable();
$changes->mod( 456 )->disable();
$changes->mod( 18 )->disable();
$changes->mod( 214 )->disable();
$changes->mod( 252 )->disable();
$changes->mod( 196 )->disable();
$changes->mod( 470 )->disable();
$changes->mod( 324 )->disable();
}
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » Hide all module with exceptions when...
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5944
- Posts this week:
- 2
- User Info:
- Total Users:
- 7658
- Newest User:
- carre82601
- Members Online:
- 0
- Guests Online:
- 149
- 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