Page 1 of 1

help for redirect_page tag

Posted: Wed Dec 23, 2015 6:14 pm
by unicorn
hi,
i am building a multilingual web site. i used "browser language" and "redirect page" tags on main page, so i can redirect visitors to the page in their language...

problem is that i want to insert a photo and give a short message to visitors in their language but i could not do that.

Code: Select all

{browser_lang accepted='fr,ru,en,es' default='en' assign='lang'}

{if $lang == 'fr'}
      {redirect_page page="fr"}
 {elseif $lang == 'ru'}
      {redirect_page page="ru"}
 {elseif $lang == 'es'}
      {redirect_page page="es"}
 {else}
     {redirect_page page="en"}
{/if}
no matter what code i entered between these functions, it did not work, and redirected directly...

what i tried ? php sleep, jq and java timeout etc. but it does not read the code between functions.

lets say browser language is Spanish , it should give message "bienvenida", wait 5 seconds and after redirect page to es.

could you help me ?

thank you.

Re: help for redirect_page tag

Posted: Thu Dec 24, 2015 9:02 pm
by Jeff
All smarty is rendered on the server, if you want a page display before the redirect, store the {$lang} variable or the redirectpage in a js var and then have js do a redirect (window.location = newpage) after the delay that you want.