TheQn Posted July 4, 2011 Report Posted July 4, 2011 Nezunu kapec negrib valodu no lang faila uz <title> <?php echo $title; ?></title> bet uz <body> <?php echo $lang['home']; ?> </body> vis izvada, a bet title negrib. Index.php <?php @session_start(); define('ROOT_DIR', dirname(__FILE__)); define('ENGINE_DIR', ROOT_DIR . "/engine"); require_once ROOT_DIR . '/config.php'; require_once ROOT_DIR . '/main_things.php'; $title = title($_GET['go']); ?> <title> <?php echo $title; ?></title> main_things.php <?php function title($arg) { switch($arg) { case "": $title = $lang['home']; break; case "forum": $title = $lang['forum']; break; } return $title; } ?> <?php require_once ENGINE_DIR . '/modules/language.php'; ?> modules/language.php <?php $referer = $_SERVER['HTTP_REFERER']; $languages = array('english' => 'english','latvian' => 'latvian','russian' => 'russian'); if(isset($_GET['lang'])) { $language = $_GET['lang']; setcookie('lang', $language, time()+(3600*24*365), "/"); header("Location: $referer"); } elseif(isset($_COOKIE['lang'])) { $language = $_COOKIE['lang']; } else { $language = "russian"; } if(!(in_array($language,array_keys($languages)))) { die("Sorry, but this language does not exists!"); } require_once ENGINE_DIR . "/languages/{$language}.php"; ?> russian.php <?php $lang = array( 'home' => 'Главная', 'forum' => 'Форум' ); ?>
Aleksejs Posted July 4, 2011 Report Posted July 4, 2011 Es pārtaisītu: function title($arg) { switch($arg) { case "": $title = $lang['home']; break; case "forum": $title = $lang['forum']; break; } return $title; } par function title($arg) { switch($arg) { case "forum": $title = $lang['forum']; break; default: $title = $lang['home']; } return $title; }
TheQn Posted July 4, 2011 Author Report Posted July 4, 2011 Nestrada! kak es uzrakstu http://lapaaa. lv/?go=forum negrib izvadit Форум, un tas pats ar http://lapa/ negrib izvadit Главная.
Rincewind Posted July 4, 2011 Report Posted July 4, 2011 Varētu būt problēma ar mainīgo redzamību. Ieliec echo, apskaties vaivispār kaut ko izvada: case "forum": echo '-'.$lang['forum'].'-'; $title = $lang['forum'];
Aleksejs Posted July 4, 2011 Report Posted July 4, 2011 function title($arg) { global $lang; switch($arg) { case "forum": $title = $lang['forum']; break; default: $title = $lang['home']; } return $title; }
TheQn Posted July 4, 2011 Author Report Posted July 4, 2011 (edited) Rincewind, vispar neko neuzrada tikai - - pasa <body></body> bet ne title. Edited July 4, 2011 by TheQn
TheQn Posted July 4, 2011 Author Report Posted July 4, 2011 (edited) Vis strada nepamaniju ka tur ir global $lang; :D un vel viens jautajums ne par temu kak ar rewrite taisit /?go=bans&details=1 uz so /bans/details/1 un so /?go=bans&page=1 uz so /bans/page/1 es taisiju ta RewriteRule ^bans/details/([0-9]*)$ ?go=bans&details=$1 [L] un RewriteRule ^bans/page/([0-9]*)$ ?go=bans&page=$1 [L] un nestrada.. Un tad var Topic Close! Edited July 4, 2011 by TheQn
daGrevis Posted July 4, 2011 Report Posted July 4, 2011 P.S. Tu pats varēsi "topic close". Es to nedarīšu!
Val Posted July 4, 2011 Report Posted July 4, 2011 RewriteRule ^bans/details/([0-9]+)$ index.php?go=bans&details=$1 [L] RewriteRule ^bans/page/([0-9]+)$ index.php?go=bans&page=$1 [L] derēs?
TheQn Posted July 4, 2011 Author Report Posted July 4, 2011 (edited) Val ne nestrada. man visi fails bans.php atrodas engine/includes/bans.php izvadu uz main lapu ar so scriptu <?php if($go == '') { include ENGINE_DIR . '/includes/news.php'; } else { include ENGINE_DIR . '/includes/'.$go.'.php'; } echo "\n"; ?> Edited July 4, 2011 by TheQn
Recommended Posts