Jump to content
php.lv forumi

Valodas


GeRik

Recommended Posts

Kads nevaretu pateikt kur ir vaina ?

<?

$languages = array('en' => 'English',
                  'ru' => 'Russian',
                  'lv' => 'Latvian');

 if (isset($_GET['valoda'])) {

 $lang = $_GET['valoda'];
 setcookie('valoda', $lang, time()+(3600*24*365));

}else if (isset($_COOKIE['valoda'])) {
 $lang = $_COOKIE['valoda'];
} else {
 $lang = 'lv';
}

if (!(in_array($lang, array_keys($languages)))) {
 die("ERROR: Trukst Valodas fails!");
}
include("valoda/$lang.php");
include("config/config.php");
?> 

Link to comment
Share on other sites

Nu es izlasiju un nedabuju risinajumu

<?
session_start();
$languages = array('en' => 'English',
                                  'lv' => 'Latvian',
                                  'ru' => 'Russian');

 if (isset($_GET['lang'])) {

 $lang = $_GET['lang'];
setcookie('lang', $lang, time()+(3600*24*365));


}else if (isset($_COOKIE['lang'])) {
 $lang = $_COOKIE['lang'];
} else {
 $lang = 'lv';
}

if (!(in_array($lang, array_keys($languages)))) {
 die("ERROR: Bad Language String Provided!");
}
include "language/{$lang}.php";
include("config/config.php");
?> 

Un man shis Skripts atrodas Pasha pasha augsha pectam seko tikai

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

u.t.t ! Pievienoju to session start un iznakums shads

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\AppServ\www\index.php:1) in C:\AppServ\www\index.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\AppServ\www\index.php:1) in C:\AppServ\www\index.php on line 2

Problema bij ar tiem BOM kodiem Paldies visiem :)

Edited by GeRik
Link to comment
Share on other sites

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.

Loading...
×
×
  • Create New...