Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.


ditmedie
Beginner Modder
ranks
useravatar
User Info

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?


Administrator has disabled public posting
metamodguy
useravatar
User Info

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

Administrator has disabled public posting

Board Info

Board Stats:   Total Users: 3088  Total Topics: 1195  Total Polls: 7  Total Posts: 4450  Total Posts Today: 2
User Info:   Newest User :  timothy.brown2@gmail.com   Members Online: 2   Guests Online: 119
Topic
New
Locked
Topic
New
Locked
Sticky
Active
New/Active
Sticky
Active
New/Active
New/Closed
New Sticky
Closed/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky Active Locked
Active/Sticky
Sticky/Locked
Sticky/Active/Locked