Jump to content

Solved! How to change the links in the Blocklanguages


Recommended Posts

Hi!

 

Can anyone be so kind as to telll med how can I change the links in the blocklanguages.tpl so they point to the right URLs?

 

My website is bilingual, Swedish and English. It has been working fine. But I discovered today that the links in the Blocklanguage changed for some unkown reason and both Swedish and English ponit suddenly to 404 page. The link to Swedish changed to "www.i-smycken.se/sv/index". it shoud be "www.i-smycken.se/sv/" of course. And the link to English changed to "www.i-smycken.se/en/index". It should of course be "www.i-smycken.se/en/"

 

The blocklanguages.tpl looks like this:

 

<!-- Block languages module -->
{if count($languages) > 1}
<div id="languages_block_top">
    <div id="countries">
    {* @todo fix display current languages, removing the first foreach loop *}
{foreach from=$languages key=k item=language name="languages"}
    {if $language.iso_code == $lang_iso}
        <p class="selected_language">
            <img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" />
        </p>
    {/if}
{/foreach}
        <ul id="first-languages" class="countries_ul">
        {foreach from=$languages key=k item=language name="languages"}
            <li {if $language.iso_code == $lang_iso}class="selected_language"{/if}>
            {if $language.iso_code != $lang_iso}
                {assign var=indice_lang value=$language.id_lang}
                {if isset($lang_rewrite_urls.$indice_lang)}
                    <a href="{$lang_rewrite_urls.$indice_lang|escape:htmlall}" title="{$language.name}">
                {else}
                    <a href="{$link->getLanguageLink($language.id_lang)|escape:htmlall}" title="{$language.name}">

                {/if}
            {/if}
                    <img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" />
            {if $language.iso_code != $lang_iso}
                </a>
            {/if}
            </li>
        {/foreach}
        </ul>
    </div>
</div>

<script type="text/javascript">
$(document).ready(function () {
    $("#countries").mouseover(function(){
        $(this).addClass("countries_hover");
        $(".countries_ul").addClass("countries_ul_hover");
    });
    $("#countries").mouseout(function(){
        $(this).removeClass("countries_hover");
        $(".countries_ul").removeClass("countries_ul_hover");
    });

});
</script>
{/if}
<!-- /Block languages module -->
 

How to change the links?

 

Thanks in advance.

 

Hong

Edited by salomonsson (see edit history)
Link to comment
Share on other sites

well, i don't know what's goin on there but you can use little workaround :)

 

it's a modifier: |replace:'/index':'/'

add it to {$lang_rewrite_urls.$indice_lang|escape:htmlall} and {$link->getLanguageLink($language.id_lang)|escape:htmlall}

                    <a href="{$lang_rewrite_urls.$indice_lang|escape:htmlall}" title="{$language.name}">
                    <a href="{$link->getLanguageLink($language.id_lang)|escape:htmlall}" title="{$language.name}">
Link to comment
Share on other sites

HI vekia!

 

Thank you for your reply. I tried, but it doesn't work. Have I done correctly?  I doubt.

 

<a href="|replace:'/index':'/' {$lang_rewrite_urls.$indice_lang|escape:htmlall} " title="{$language.name}">
                {else}
                    <a href="|replace:'/index':'/' {$link->getLanguageLink($language.id_lang)|escape:htmlall} " title="{$language.name}">

Link to comment
Share on other sites

noo :) sorry, i should describe it better

<a href="{$lang_rewrite_urls.$indice_lang|replace:'/index':'/'|escape:htmlall}" title="{$language.name}">
 <a href="{$link->getLanguageLink($language.id_lang)|replace:'/index':'/'|escape:htmlall}" title="{$language.name}">
Link to comment
Share on other sites

×
×
  • Create New...