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.

 

Overriding a set a rules with a single rule

Overriding a set a rules with a single rule

Hi Stephen, I have been experimenting with metatemplate pro a lot. I have quite a lot of rules and sometimes a template will be set reluctantly, because of my lack of understand of the chain of rules perhaps.

For example using a rule which detect the referrer "contains" the expression "/en/", it can conflict with another geoip rule in the same session.

Is there anyway to make a rule override all the other rules permanently once it's been called?

Cheers

atherrien
Modder Extraordinaire
ranks
useravatar
Offline
140 Posts
Administrator has disabled public posting

Re: Overriding a set a rules with a single rule

If by "permanent override" you mean forever, then I'd set a permanent cookie in the SUCCEED action of that rule. Then, I'd make another rule at the start of the chain that detects that permanent cookie, sets the template (or whatever), then stops processing the rule chain.

Is that what you're after?

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

Re: Overriding a set a rules with a single rule

Yes it make sense.

So it would be something like this in the SUCCEED php box?

Code:

/* 2: delete all cookies A-H: */


$time = time() - 60*60*24*365*10;
setcookie( 'MT1', '', $time, '/' );
setcookie( 'MT2', '', $time, '/' );
setcookie( 'MT3', '', $time, '/' );
setcookie( 'MT4', '', $time, '/' );
setcookie( 'MT5', '', $time, '/' );
setcookie( 'MT6', '', $time, '/' );
setcookie( 'MT7', '', $time, '/' );
setcookie( 'MT8', '', $time, '/' );


/* 3: delete only cookie H: */

$time = time() - 60*60*24*365*10;
setcookie( 'MT8', '', $time, '/' );


/* 4: set cookie H: */

$time = time() + 60*60*24*365*10;
setcookie( 'MT8', 1, $time, '/' );

But I noticed even though I did that for most of my rules, once that permanent cookie is detected "landing=x", it can still be deleted and reseted by another rule when for example it detects a new referrer that is part of another rule, like "landing=y".

Any ideas?
Cheers

atherrien
Modder Extraordinaire
ranks
useravatar
Offline
140 Posts
Administrator has disabled public posting

Re: Overriding a set a rules with a single rule

If you don't want other rules to be able to override the cookie that was set, you need to do this:

Make the rule that detects the cookie. Put it early in the chain (e.g. first). Ensure it performs the actions that you want it to.

Then in the SUCCEED action, ensure that you set "stop processing" at the end of the SUCCEED action. That way, MetaTemplate will never get to the other rules that could override that cookie. It will quit the whole rule chain.

Best regards,
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
3328 Posts
User info in posts
Administrator has disabled public posting

Re: Overriding a set a rules with a single rule

Thanks, that's what I was doing already, but sometimes it gets confusing, and unwanted template switch occurs. I will try to find to best rule sequence that suit my needs.

Cheers.

atherrien
Modder Extraordinaire
ranks
useravatar
Offline
140 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1686
Total Polls:
6
Total Posts:
5933
Total Posts Today:
7
User Info:
 
Total Users:
4432
Newest User:
kinggambling14
Members Online:
0
Guests Online:
125

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