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
- » Required code/PHP for nested if?...
Required code/PHP for nested if? $option=com_xxx with Itemid=XXX ?
Required code/PHP for nested if? $option=com_xxx with Itemid=XXX ?
Hi,
I am dealing with nested if (if that is the correct term) for specific details which are
1) only viewable to non-registered user
PLUS/ADD or OR
2) specific components for instance; $option=com_xxx with itemid=xxx
For example purposes, say it is $option=com_jreview which only has one view in backend (not like others which have Blog view, article view, etc.)
So the only way to specifically refer to a page is by it's itemid. What is the needed/formatted code to specifically achieve this? Which one should go first etc?
For the sake of learning, let's make the conditions.
1) Only viewable for non-registered users
2) restricted to com_jreview + itemid=1
return module id=10
else return module id=
Thank you for your time and concern. Please advise.
08-Oct-09 03:54:17
Re: Required code/PHP for nested if? $option=com_xxx with Itemid=XXX ?
Hi Pembaris,
try this, which expects that ALL conditions are met:
Code:
if (MM_NOT_LOGGED_IN and $option == "com_jreview" and $Itemid == 1) return 10;
Alternatively, this one triggers if the user is not logged in OR they are looking at com_jreview on menu (Itemid) 10:
Code:
if (MM_NOT_LOGGED_IN or ( $option == "com_jreview" and $Itemid == 1 )) return 10;
Note the use of "(" and ")" to group conditions that have to go together. In this case it was not compulsory, but it's a good idea to always include these to make it 100% clear which conditions go together. e.g. X and (Y or Z) e.g. X or (Y and Z)
Re: Required code/PHP for nested if? $option=com_xxx with Itemid=XXX ?
quick reply and great support!
I clearly understand this and can refer on this from now on!
Let's have a testimonial page for letting the goodness of MetaMod Pro product & support out to the web world.
Thanks again!
Re: Required code/PHP for nested if? $option=com_xxx with Itemid=XXX ?
Hmmm, good idea! Once I set one up I'll send you a note to ask for a testimonial!
Thanks for your e-mail.
By the way, did you know that you can leave reviews on the Joomla Extensions Directory site?
MetaMod has a page at http://extensions.joomla.org/extensions/3391/details
Cheers,
Stephen
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » Required code/PHP for nested if?...
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:
- 153
- 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