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.

 

Template per language switching problem

Template per language switching problem

Hello and thanks in advance for your help.  Here's what I've done so far. 

I've created a 'splash page' with images (US flag, Canadian Flag - English and Canadian Flag -French) that each have links to specific webpages ie.  US flag = www.mydomainname.com/en_us/welcome.

I've created a seperate template for the splash page, an english template for canadian english and US and a french template for the canadian french site.

I created only one rule for the template switching and included currency changes too.  Here's what the php code looks like in the advanced box :

if ($core_genius->check("uri equals http://www.mydomainname.com/")) return "mytemplate_splash";

if ($core_genius->check("uri equals http://www.mydomainname.com/en/welcome")) return "mytemplate_english_canada" and JRequest::setVar("product_currency","CAD");

if ($core_genius->check("uri equals http://www.mydomainname.com/en_us/welcome")) return "mytemplate_english_US" and JRequest::setVar("product_currency","USD");

if ($core_genius->check("uri equals http://www.mydomainname.com/fr/accueil")) return "mytemplate_french" and JRequest::setVar("product_currency","CAD");


The currency part works great, but the canadian - french and canadian english sites are not switching to the proper template. 

I've tried putting each one of these rules in a separate rule with the splash one as the first, but it doesn't make any difference.

Any idea as to what may be the problem?

Thanks and have a great day.

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

Re: Template per language switching problem

Hi,

it's just a slight PHP problem. You can't generally use "and" in this way to perform 2 operations. This has unexpected results like what you are seeing. Try structuring it like this:


if ($core_genius->check("uri equals http://www.mydomainname.com/")) return "mytemplate_splash";

if ($core_genius->check("uri equals http://www.mydomainname.com/en/welcome")) {
  JRequest::setVar("product_currency","CAD");
  return "mytemplate_english_canada";
}

if ($core_genius->check("uri equals http://www.mydomainname.com/en_us/welcome")) {
  JRequest::setVar("product_currency","USD");
  return "mytemplate_english_US";
}

if ($core_genius->check("uri equals http://www.mydomainname.com/fr/accueil")) {
  JRequest::setVar("product_currency","CAD");
  return "mytemplate_french";
}



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

Board Info

Board Stats:
 
Total Topics:
1674
Total Polls:
6
Total Posts:
5917
Total Posts Today:
5
User Info:
 
Total Users:
11540
Newest User:
caron5112
Members Online:
1
Guests Online:
127

Online: 
caron5112

Forum Legend:

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