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.

 

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.

Edited By: pembaris
08-Oct-09 02:54:17

pembaris
Beginner Modder
ranks
useravatar
Offline
16 Posts
Administrator has disabled public posting

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)

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

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!

pembaris
Beginner Modder
ranks
useravatar
Offline
16 Posts
Administrator has disabled public posting

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

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:
11529
Newest User:
jame380003
Members Online:
0
Guests Online:
238

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