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.

 

Module not working when more than one page is added?

Module not working when more than one page is added?

j 1.5.8
VM 1.1.5

Mod works when php code is added ie:

$vm = JomGenius("virtuemart"); // need this at the start of every rule
if ( $vm->check( "pagetype not starts with checkout" ) ) return advert1;

or

$vm = JomGenius("virtuemart"); // need this at the start of every rule
if ( $vm->check( "pagetype not = shop.cart" ) ) return advert1;

Does not work when I add more pages ie:

$vm = JomGenius("virtuemart"); // need this at the start of every rule
if ( $vm->check( "pagetype not = frontpage, shop.cart" ) ) return advert 1;

or

$vm = JomGenius("virtuemart"); // need this at the start of every rule
if ( $vm->check( "pagetype not = frontpage, shop.cart, checkout.index#1, checkout.index#2, checkout.index#3, checkout.index#4, checkout.thankyou" ) ) return advert1;

Thank you in advance.

chriskabisch
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Re: Module not working when more than one page is added?

Hi Chris,

That's a great question - thanks for asking it on the forum. [sorry about the delay in responding, I took a few days off].

OK, so let's look at what you're trying to achieve.

You're retrieving one parameter (pagetype) which can only be one value at a time. You then want to compare it to a list of items (frontpage, shop.cart, etc), and you want the module to be included if it doesn't equal any of them.

The way JomGenius does this is that it compares the item on the left (the page type in this case) to each of the items on the right, in turn, using the comparison operator that you specified ("not =" in this case).

You might ask: "so does it do an AND or an OR?" (i.e. does it check for "pagetype = frontpage OR pagetype = shop.cart OR ...", or does it check for "pagetype = frontpage AND pagetype = shop.cart AND ...".

The answer is: by default it does an "OR".

More precisely, it does an "any of" unless you specify "all of" or "none of".

So, saying "pagetype not = frontpage, shop.cart" is equivalent to "pagetype not = any of frontpage, shop.cart", and this expands internally to "pagetype not = frontpage OR pagetype not = shop.cart OR ...".

Now if you think about it, this isn't going to work. If the pagetype actually was frontpage, you would want the statement to return false. But, "pagetype not = shop.cart" would be true, so the whole thing would return "true".

What you really want is that the page type is NONE of the items in the list.

So the correct syntax would be this:

if ( $vm->check( "pagetype = none of frontpage, shop.cart, checkout.index#1, checkout.index#2, checkout.index#3, checkout.index#4, checkout.thankyou" ) ) return advert1;

Hope that makes sense. If not, read it several times slowly!

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:
1698
Total Polls:
6
Total Posts:
5944
Posts this week:
4
User Info:
 
Total Users:
5544
Newest User:
odom3140505
Members Online:
1
Guests Online:
113

Online: 
odom3140505

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked