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.

 

Handling Multiple Recipes Issue

Handling Multiple Recipes Issue

Hi and thanks in advance,

Sorry I know multiple recipes has been address with the use of arrays but I'm having difficulty getting this to work.

J1.5 / VM 1.9 (sorry - old site!)

I have 2 modules in same position, one to show for logged in, the other for non-registered user. This was easy to implement via Metamod, but I also want to hide both modules from VM pages (also easy to implement)...

if ($option == "com_virtuemart" and JRequest::getVar("page") == null) return 116;
if ($option == "com_virtuemart" and JRequest::getVar("page") == null) return 128;
if ( MM_NOT_LOGGED_IN ) return 116; else return 128;

But the how to implement both in one recipe? I tried this

$r = array();
if ( MM_NOT_LOGGED_IN ) $r[] = 116; else $r[] = 128;
if ($option == "com_virtuemart" and JRequest::getVar("page") == null) $r[] = 116;
if ($option == "com_virtuemart" and JRequest::getVar("page") == null) $r[] = 128;
return $r;

... but get both mods displaying. Any help gratefully received!

Much appreciated...

marmaliser
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Re: Handling Multiple Recipes Issue

Hi, that's a good question. It can be a little tricky to get the logic right, but once you have it set up it will seem easy!

The simplest way to do this is to return "nothing" for the pages that you don't want the modules to appear on. That will do a short-circuit for those pages. Then check for specific conditions after that.

if ($option == "com_virtuemart" and JRequest::getVar("page") == null) return; // nothing on that page!
if ( MM_NOT_LOGGED_IN ) return 116; else return 128; // logged-in / not logged in for all other pages.

Is that what you're after?

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

Board Info

Board Stats:
 
Total Topics:
1691
Total Polls:
6
Total Posts:
5912
Total Posts Today:
6
User Info:
 
Total Users:
11527
Newest User:
david9684
Members Online:
0
Guests Online:
199

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