Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Handling Multiple Recipes Issue
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...
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
- Index
- » MetaMod
- » MetaMod General Support
- » Handling Multiple Recipes Issue
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5942
- Posts this week:
- 2
- User Info:
- Total Users:
- 7634
- Newest User:
- boratuglu
- Members Online:
- 0
- Guests Online:
- 169
- 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