Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.


bgiguere
Beginner Modder
ranks
useravatar
User Info

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.


Administrator has disabled public posting
metamodguy
useravatar
User Info

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

Administrator has disabled public posting

Board Info

Board Stats:   Total Users: 3073  Total Topics: 1195  Total Polls: 7  Total Posts: 4448  Posts this week: 19
User Info:   Newest User :  mdfavionics   Members Online: 0   Guests Online: 88
Online  There are no members online
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