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.

 

Change template through GET arguments and session variables.

Change template through GET arguments and session variables.

Hi.
With "MetaTemplate" or "MetaTemplatePro" it's possible to make the following thing: With a GET parameter to change template and mantain the template choice into a session variable?
Regards.
K84pd5

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

Re: Change template through GET arguments and session variables.

Hi k84pd5,

sure - this is easy to do.

You'll make a rule that detects the GET parameter, and returns "true" from the PHP code.
Then, for the SUCCEED action you'll set the desired template, and set the cookie.

In the second rule you will detect the cookie, and use that to set the template in the SUCCEED rule.

FIRST RULE:

In the PHP box:
if (JRequest::getVar("testme") == "1") return true;

... then in the SUCCEED action, set the desired template, and "Set Session Variable A".

SECOND RULE:

In the "Quick Rules" near the top of the page, set "Detect Cookie/Session variable" to "Session Variable A"
... don't put anything in the PHP box
... select the desired template in the SUCCEED action.

TO USE:
enter your site with http://example.com/mypage?testme=1
The new template should be used for the rest of the session.

p.s. this is done exactly the same in MetaTemplate and MetaTemplate Pro.

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

Re: Change template through GET arguments and session variables.

Hi there,

I have found this extremely helpful, but would like to extend this to enable them to switch to another template

Eg if they selected a link that said:

http://example.com/mypage?testme=2

If they haven't selected the link http://example.com/mypage?testme=2 and are using pages that just have no reference to ?testme= eg http://example.com/mypagelink2  then I want them to continue using the template 1 until the move to 2.

Does this make sense?

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

Re: Change template through GET arguments and session variables.

Hi annamations,

I just replied to your other post, which I think answers this question.

http://www.metamodpro.com/forums/topic?id=666


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:
1683
Total Polls:
6
Total Posts:
5940
Posts this week:
11
User Info:
 
Total Users:
5142
Newest User:
zaki98040
Members Online:
0
Guests Online:
180

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