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.

 

Doesn't display secound module when using 2 if sentences

Doesn't display secound module when using 2 if sentences

In Joomla 1.5 I had no problem entering 2 if sencences like this:

if (
$option == 'com_redshop'
and JRequest::getVar('cid') == '') return 225;

if (
$option == 'com_redshop'
and $view == 'category'
and $Itemid == '101'
) return 226;

Now I'm using Joomla 1.7 and the 1.7 metamod, but when entering the above only the first module is showing. Is it not possible in 1.7 to have 2 if sentences or is it something else?

ditmedie
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: Doesn't display secound module when using 2 if sentences

The situation should be the same in 1.5 and 1.7 -- it's just pure PHP at this stage.

That is, if the 1st condition matches, and it ends in a "return", then it won't get to the 2nd one at all.

So if you want the opportunity of both conditions matching, and therefore potentially 2 modules being returned, do it like this:

$ret = array(); // empty array ready to be filled!
if (
  $option == 'com_redshop'
  and JRequest::getVar('cid') == '') $ret[] = 225; // add to list
if (
  $option == 'com_redshop'
  and $view == 'category'
  and $Itemid == '101'
) $ret[] = 226; // add to list

return $ret; // return the list of items (or none).


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
3329 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1684
Total Polls:
6
Total Posts:
5940
Posts this week:
1
User Info:
 
Total Users:
5161
Newest User:
kbmgkey234q
Members Online:
0
Guests Online:
434

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