How to get clickable language flags instead of dropdown

I guess the title says it all. I only have 2 languages and would like the flags to always show and be clickable, instead of having the dropdown.



Shouldn’t be to hard I guess to figure out but I hope someone already knows how to do it and can tell me…



Thanks!

No one?

I actually have the same problem. I hope there's someone here who can help…

Change this section in top.tpl to use anchor tags rather than calling the selector include. You should be able to figure out which images to use based on your languages.

```php

{include file="common_templates/select_object.tpl" style="graphic" suffix="currency" link_tpl=$config.current_url|fn_link_attach:"currency=" items=$currencies selected_id=$secondary_currency display_icons=false key_name="description"}

```

Thanks!

Here we go (as you can see this is for English and German)



Where you want your flags to appear put:


Hi flow, very helpfull, i wanted to add it, but i have 3 languages installed, this is what i did:


You’re using an ‘if else else’ statement.



You should use an if, elseif and else statement, see the php documentation example below:


<br />
<?php<br />
if ($a > $<img src="upload://koLv6Nwy6blpxWjsJR7cOIcv8Nz.png" class="bbc_emoticon" alt="B)"> {<br />
    echo "a is bigger than b";<br />
} elseif ($a == $<img src="upload://koLv6Nwy6blpxWjsJR7cOIcv8Nz.png" class="bbc_emoticon" alt="B)"> {<br />
    echo "a is equal to b";<br />
} else {<br />
    echo "a is smaller than b";<br />
}<br />
?><br />

Hi Stellar, what would be the correct code then? i tried elseif but i get the same error:



Could you paste the correct code please, i am not a programmer



Thanks in advance!

Hmm, I guess it has something to do with the {else} command being used twice. I’m sure a coder can solve this very easily… but I’m not a coder :)



Anyone?

I am no coder either, Gotta finish this project :?



I tried the suggested: if / elseif / else, but doesnt work…



Can anyone paste the correct code in the one provided?



Thanks in advance


<br />
<div class="language_links"><br />
{if $languages|sizeof > 1}<br />
															    {assign var="link_tpl" value=$config.current_url|fn_link_attach:"sl="}<br />
															    <div class="languages"><br />
															    {foreach from=$languages item=item key=id}<br />
																			    <a style="margin: 5px;" rel="nofollow" name="{$id}" href="{"`$link_tpl``$id`"|fn_url}">{if $id == "EN"}<img src="{$images_dir}/flags/en.png" border="0" alt="English" title="English"/> {elseif} <img src="{$images_dir}/flags/nl.png" border="0" alt="Nederlands" title="Nederlands"/> {else} <img src="{$images_dir}/flags/es.png" border="0" alt="Espanol" title="Espanol"/>{/if}</a><br />
															    {/foreach}<br />
															    </div><br />
											    {/if}<br />

Not tested, but should work like this:


Maybe I'm missing something, but why would you want to encode all the various languages in the html with ifelse's versus letting the system do it for you? Seems to overly complicate things and is not dynamic at all…



{if $languages|sizeof > 1}


{/if}

Thank you very much!



Works like a charm!



All the best

Francois

For the new versions, 4.x.x, how to modify?

Thanks1

For the new versions, 4.x.x, how to modify?

Thanks1

Hello!

Please go to the Languages block settings on the Design->Layouts page and change Minimal number if items to be placed in a dropdown list value. For example, if you have 2 languages, specify 3 in the setting.

Great! Thanks