Hi, im working on a site that would have default language as swedish with a finnish image flag. Im using this:
if($input->get->language) {
// user clicked on a link to set the language
$name = $sanitizer->pageName($input->get->language);
$language = $languages->get($name);
if($language) $session->language = $language->name;
}
if($session->language) {
// language is defined in user's session
$user->language = $languages->get($session->language);
}
and
<a href='./?language=finnish'>Finnish flag</a>
How do i get the flag to change to a swedish flag?So that when some 1 chooses finnish the finnish flag would become swedish and link to the default page?
I have tried many if cases but didnt get them to work.
Thanks
Simon
2 replies to this topic
#2
Posted 28 April 2012 - 03:01 PM
So the only thing that's not working is changing the link (and link content), right?
If that's the case and you only have two languages, something as simple as this should do the trick:
If that's the case and you only have two languages, something as simple as this should do the trick:
<?php
$lang = ( $user->language->name == "finnish" ) ? "default" : "finnish";
echo "<a href='./?language={$lang}'>{$lang} flag</a>";
Also tagged with one or more of these keywords: language
Community Support →
Multi-Language Support →
field label language problemStarted by valan, 19 May 2013 |
|
|
||
Community Support →
Multi-Language Support →
Displaying Pages depining on languageStarted by Marcel Koch, 28 Feb 2013 |
|
|
||
Community Support →
Multi-Language Support →
setLanguageValue() doesn't work if setTrackChanges(true) isn't called before on multi language titleStarted by elitLG, 13 Aug 2012 |
|
|
||
Community Support →
General Support →
Problem with multi languagesStarted by buothz, 02 Jul 2012 |
|
|
||
Community Support →
Multi-Language Support →
how to delete languagesStarted by martind, 03 Feb 2012 |
|
|
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













