Jump to content

header.tpl


skmd

Recommended Posts

hi everybody

im trying to add this code to my header.tpl but it doesnt work can anybody help me.

i wan to display pict1.jpg if the language were spanish and else i want to display pict2.jpg

 

<?PHP
if (setlanguage=true&language=spanish)
{
echo '[img=../../../images/pict1.jpg]';
}
else
{
echo '[img=../../../images/pict2.jpg]';
}?>

Link to comment
Share on other sites

Have you tried this to troubleshoot it?

The basic template syntax can be seen by looking at the templates. All pages have specific variables which you can use. To view a complete list of variables available on a page, enter the following command into the template file:

 

{debug}

Link to comment
Share on other sites

I don't offer other languages, but you may be using the wrong variable here. In a link to switch languages, it's this: "order.php?setlanguage=true&language=Spanish". I'd suggest trying your code like this:

"{if $language eq Spanish}".

I believe "$LANG" refers to the language file that's set to be used, as in "$LANG.variablename", which would replace the variable with that phrase from the chosen language file.

Link to comment
Share on other sites

skmd,

 

I put a {debug} in my code and there is no reference to the currently selected language available.

 

You will probably need to raise a ticket to see if Matt can add a SMARTY variable for the current language before what you are trying to do will be possible.

Link to comment
Share on other sites

skmd,

 

Here is a solution for you using a known variable value from the language files - $hometitle:

 

{if $hometitle=='Inicio'} 
[img=../../../images/your_spanish.jpg] 
{else} 
[img=../../../images/your_english.jpg] 
{/if}

 

$hometitle is avaiable throughout the client area, so should work for what you are trying to do.

Link to comment
Share on other sites

Try it without the trailing / in the img tag:

 

{if $hometitle=='Inicio'} 
[img=../../../images/your_spanish.jpg] 
{else} 
[img=../../../images/your_english.jpg] 
{/if} 

 

Also replace 'Inicio' with what ever you have in your Spanish language file for $hometitle.

Link to comment
Share on other sites

This might help:

 

{if $LANG.language == "Idioma"}

<img src="../../../images/your_spanish.jpg">

{else}

<img src="../../../images/your_english.jpg">

{/if}

 

If you have changed the $_LANG["language"] = "Idioma"; in your language file, change the "Idioma" in the if statement to correspond with the correct word.

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated