elbereth Posted December 23, 2007 Share Posted December 23, 2007 ok, so im making my site and i use include function to display my content in index.php, whats more i want to have two language settings: german (the first and primary) and english (second). now when im viewing the site in my primary language its ok and include function works, when i want to change my language it directs me to the main page of an english language version and not to the translated subsite (thats the first problem), now that im in english language main site and choose a subsite it directs me to this subsite but its in german (second problem). how can i link those two scripts? here's the code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd "> <? session_start(); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Friseur Adele</title> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <? $jezyk = $_GET["jezyk"]; if (isset($jezyk) && file_exists("lang/$jezyk.php")) { $_SESSION["jezyk"] = $jezyk; } else { $_SESSION["jezyk"] = isset($_SESSION["jezyk"])?$_SESSION["jezyk"]:"de"; } include("lang/{$_SESSION["jezyk"]}.php"); ?> <p> <div id="exCenter"> <img id="exHeader" src="http://elbereth.neostrada.pl/braz/logo.jpg" usemap="#lang"/> <map name="lang"> <area shape=rect coords="764,24,795,43" href="index.php?jezyk=de"> <area shape=rect coords="795,24,833,43" href="index.php?jezyk=en"> </map> <div id="exContent"> <div id="exLeftColumn"> <img id="topmenu" src="http://100pdh.jdm.pl/friz/braz/manuheader.jpg "/> <?= L_menuhead ?> <ul> <li><a href="index.php?dzial=main"><?= L_menu1 ?></a></li> <li><a href="index.php?dzial=news"><?= L_menu2 ?></a></li> <li><a href="index.php?dzial=offer"><?= L_menu3 ?></a></li> <li><a href="index.php?dzial=gallery"><?= L_menu4 ?></a></li> <li><a href="index.php?dzial=about"><?= L_menu5 ?></a></li> <li><a href="index.php?dzial=contact"><?= L_menu6 ?></a></li> <li><a href="index.php?dzial=open"><?= L_menu7 ?></a></li> <li><a href="index.php?dzial=guestbook"><?= L_menu8 ?></a></li> </ul> <img id="stopkamenu" src="http://100pdh.jdm.pl/friz/braz/stopkamenu.gif "/> </div> <div id="exRightColumn"> <img src="http://100pdh.jdm.pl/friz/braz/head.jpg"/> <div id="text"> <?php if(isset($dzial)){ if(file_exists($dzial.".php")){ $plik = $dzial.".php"; include($plik); }else{ echo "Error"; } }else{ include("main.php"); } ?> </div> <img id="stopka" src="http://100pdh.jdm.pl/friz/braz/stopka.gif"/> </div> </div> </div> </p> </body> </html> files main.php, news.php, offer.php contain links to definitions located in language files en.php and de.php in the lang folder. Quote Link to comment https://forums.phpfreaks.com/topic/82858-include-different-language-versions/ 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.