rilana Posted December 12, 2007 Share Posted December 12, 2007 Hello everyone I am making a multilanguage site. Meaning that the english Navigation will have a little (d) for german. And by clicking on it the same page from a different folder should be displayed. So far I cam up with: <?php function sprache() { switch($_REQUEST['language']) { case 'englisch': HEADER("Location:/english/"); break; case 'deutsch': HEADER("Location:/deutsch/"); } } ?> For the header in each document and <a href="?language=deutsch">deutsch</a> for the link that should call the funktion I am shure that this should be a verry easy task, but my knowledge of php and coding are not verry good as you can see. I realy would aprechiate to get some help, some pointers how to get this thing working. Thank you verry much, Rilana Quote Link to comment https://forums.phpfreaks.com/topic/81369-language-switch-problem/ Share on other sites More sharing options...
sureshp Posted December 12, 2007 Share Posted December 12, 2007 Try like this ========= case "english": header("Location: " . $_SERVER['DOCUMENT_ROOT'] . "/english/"); exit; break; case "deustch": header("Location: " . $_SERVER['DOCUMENT_ROOT'] . "/deustch/"); exit; break; Quote Link to comment https://forums.phpfreaks.com/topic/81369-language-switch-problem/#findComment-412941 Share on other sites More sharing options...
rilana Posted December 12, 2007 Author Share Posted December 12, 2007 thanks something is defenetly happening now. but it doesn't work fully yet. When I klick on de (d) it cant find the page because it is looking in the wrong directory. I used this code.... <?php function sprache() { switch($_REQUEST['language']) { case "english": header("Location: " . $_SERVER['DOCUMENT_ROOT'] . "../english/"); exit; break; case "deutsch": header("Location: " . $_SERVER['DOCUMENT_ROOT'] . "../deutsch/"); exit; break; } } ?> And unsted of going ../english it goes english/deutsch maby the $_SERVER['DOCUMENT_ROOT'] has something to do with that. thats why I tryed ../deutsch but it still doesn't work. Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/81369-language-switch-problem/#findComment-412995 Share on other sites More sharing options...
sureshp Posted December 12, 2007 Share Posted December 12, 2007 Don't use "../english" or "../deutsch" in the location path. if your website url for english version is http://yoursite.com/english means, just use $_SERVER['DOCUMENT_ROOT'] . "/english" Got it? Quote Link to comment https://forums.phpfreaks.com/topic/81369-language-switch-problem/#findComment-412999 Share on other sites More sharing options...
rilana Posted December 12, 2007 Author Share Posted December 12, 2007 yes, but it still goes english/deutsch unstead of just deutsch Quote Link to comment https://forums.phpfreaks.com/topic/81369-language-switch-problem/#findComment-413011 Share on other sites More sharing options...
rilana Posted December 12, 2007 Author Share Posted December 12, 2007 could it be that me link <a href="?language=english"> </a> is wrong? Quote Link to comment https://forums.phpfreaks.com/topic/81369-language-switch-problem/#findComment-413014 Share on other sites More sharing options...
sureshp Posted December 12, 2007 Share Posted December 12, 2007 Try by using /?language=english Quote Link to comment https://forums.phpfreaks.com/topic/81369-language-switch-problem/#findComment-413029 Share on other sites More sharing options...
rilana Posted December 12, 2007 Author Share Posted December 12, 2007 ok it must be someting with my navigation file, cause when I put the link directely in the page without include then the script works.... I think I will figure it out now! thanks a lot Quote Link to comment https://forums.phpfreaks.com/topic/81369-language-switch-problem/#findComment-413037 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.