Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » How many queries will one metamod...
How many queries will one metamod module run?
How many queries will one metamod module run?
Hi,
I've got metamod working and it's great. However when I try to run multiple queries it only ever returns the result of the first query.
Can metamod only run one query at a time?
If so, could I publish multipe metamods to a right column and have them all working?
Many thanks
Re: How many queries will one metamod module run?
Hi otooles,
the simple answer is "yes you can".
The more complex answer is "yes, but you have to recode the PHP a little".
The main point to remember is that whenever you use a "return" statement, execution of the PHP immediately ceases, and the module ids returned will determine the modules to be displayed.
Therefore if you want a series of "tests" or recipes, then you need to cumulatively add module ids to a list (technically, an "array"). Then you can return that array at the end of the rule and it will contain only the ids that you added to it earlier.
Here's an example of 2 rules, done the wrong way if you want the possibility of both module ids being returned:
if ( $option == "com_contact" ) return 55;
if ( $core_genius->check("browser = safari") ) return 66;
Do it this way instead:
$r = array(); // an empty array - always declare it first
if ( $option == "com_contact" ) $r[] = 55; // add "55" to the array in the Contact component
if ( $core_genius->check("browsertype = safari") ) $r[] = 66; // add "66" to the array if the browser is safari
return $r; // may be empty, or contain one or both of 55 and 66.
In case you're wondering, the syntax $r[] = value means "add the value value onto the end of the array".
Hope that helps,
Stephen
- Index
- » MetaMod
- » MetaMod General Support
- » How many queries will one metamod...
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5941
- Posts this week:
- 1
- User Info:
- Total Users:
- 7618
- Newest User:
- goure1dhowen
- Members Online:
- 0
- Guests Online:
- 121
- 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