gottberg Posted April 28, 2012 Posted April 28, 2012 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
teppo Posted April 28, 2012 Posted April 28, 2012 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: <?php $lang = ( $user->language->name == "finnish" ) ? "default" : "finnish"; echo "<a href='./?language={$lang}'>{$lang} flag</a>"; 1
gottberg Posted May 6, 2012 Author Posted May 6, 2012 Thanks for the reply, with flag i meant images but im not getting that to work correctly but the text changed with your suggestion!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now