Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » Chameleon / ChameleonLite
- » ChameleonLite
- » Template per language switching problem
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.
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
- Index
- » Chameleon / ChameleonLite
- » ChameleonLite
- » Template per language switching problem
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5943
- Posts this week:
- 2
- User Info:
- Total Users:
- 7642
- Newest User:
- mary26
- Members Online:
- 0
- Guests Online:
- 166
- 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