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
- » PHP operator 'or' and 'case'
PHP operator 'or' and 'case'
Re: PHP operator 'or' and 'case'
Hi,
If you want to do "or" conditions you should surround them in brackets otherwise they won't work as expected. But you're nearly there!
Try this:
if (
$option == 'com_k2'
and ( $id == '352split-marjanske-crkvice' or $id == '403split' )
) return 171;
For documentation for this, I'd advise you to google for a tutorial on basic PHP programming in your language.
Cheers,
Stephen
Re: PHP operator 'or' and 'case'
startprogram asked:
"I must create 30 menu modules, and show depend on K2 article
I already create 30 menus, each with 5 menu items
Is it possible to programming code and show menu in one metamod module, depend on K2 item?"
Answer:
Yes, you can put all of these into 1 MetaMod, to save you having to create 30 different MetaMods (as well as the 30 menu modules).
You could do it like this:
if ($option != "com_k2") return; // bypass the rest if it's not a K2 page
switch ($id) {
case '352split-marjanske-crkvice': return 171;
case '403split': return 171;
case '999somethingelse': return 1001;
case '998nicetown': return 1002;
// add more case statements here, each
// returning a different module number
}
// always follow the last case statement with the end bracket you see above!
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » PHP operator 'or' and 'case'
Board Info
- Board Stats:
- Total Topics:
- 1699
- Total Polls:
- 6
- Total Posts:
- 5965
- Posts this week:
- 3
- User Info:
- Total Users:
- 8011
- Newest User:
- ignac84502
- Members Online:
- 0
- Guests Online:
- 281
- 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