Jump to content

Header link


Recommended Posts

Hi,

 

I putted a code into my header.tpl to get a link to Q & A and Contact. Wen people go on my website with the language dutch I want the link to the dutch page. When they us my site in French I want them to go to the Frence page.

 

Can anyone help me out what i'm doing wrong?

 

Website: www.mynewborn.be

 

Code:

 

<div class=" 
 col-md-6">
    <div class="bd-layoutcolumn-72"><div class="bd-vertical-align-wrapper"><div class=" bd-textblock-86 bd-tagstyles">
    <p style=""><a href="{$link->getCMSLink('6', 'q-a')}" title="">{l s='Q & A'}</a>     <a href="{$link->getPageLink('contact', true)}" title="">{l s='Contact'}</a><br style=""></p>
</div></div></div>
</div>
Edited by mynewborn (see edit history)
Link to comment
Share on other sites

Its very simple. You can use the variable {$lang_id} along with {if} statement and write the full URL of the page instead of writing "getPageLink".

{if $lang_id == 1} <a href="Write_Full_URL_For_French">Contact</a> {/if}
{if $lang_id == 2} <a href="Write_Full_URL_For_Dutch">Contact</a> {/if}

Do not forget to replace the appropriate language ID which can be checked from Back-office > Localization > Languages.

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

So this would be the code?

<div class=" 
 col-md-6">
    <div class="bd-layoutcolumn-72"><div class="bd-vertical-align-wrapper"><div class=" bd-textblock-86 bd-tagstyles">
    <p style="">{if $lang_id == 1} <a href="Write_Full_URL_For_French">Q & A</a> {/if}
{if $lang_id == 2} <a href="Write_Full_URL_For_Dutch">Q & A</a> {/if}     {if $lang_id == 1} <a href="Write_Full_URL_For_French">Contact</a> {/if}
{if $lang_id == 2} <a href="Write_Full_URL_For_Dutch">Contact</a> {/if}<br style=""></p>
</div></div></div>
</div>

I can't see the language ID on the backoffice like you say. Do I need to check it into database?

Link to comment
Share on other sites

I tried it and still doesn't work. This is the code at this moment. I checked the language ID and set correct. (just changed French and Dutch).

<div class=" 
 col-md-6">
    <div class="bd-layoutcolumn-72"><div class="bd-vertical-align-wrapper"><div class=" bd-textblock-86 bd-tagstyles">
    <p style="">{if $lang_id == 1} <a href="Write_Full_URL_For_Dutch">Q & A</a> {/if}
{if $lang_id == 2} <a href="Write_Full_URL_For_French">Q & A</a> {/if}     {if $lang_id == 1} <a href="Write_Full_URL_For_Dutch">Contact</a> {/if}
{if $lang_id == 2} <a href="Write_Full_URL_For_French">Contact</a> {/if}<br style=""></p>
</div></div></div>
</div>
            </div>
        </div>
    </div>
</div>
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...