Jump to content
php.lv forumi

imop

Reģistrētie lietotāji
  • Posts

    30
  • Joined

  • Last visited

Everything posted by imop

  1. Piemirsu ierakstīt erorr: tad nu: Parse error: syntax error, unexpected T_FUNCTION in /var/www/HOSTINGS/MACIBU/language.php on line 41
  2. Cenšos apgūt vairāku valodu funkciju vienā lapā, tamdēļ parakos google un atradu vienu man piemērotu variantu ar kuru varētu darboties, bet visu laiku met ārā vienu problēmu ka nav pareizi definēta funkcija - function switch_language_options() language.php <?php // This is a library, that by including it, // automatically determines the proper language // to use and includes the language file. // First define an array of all possible // languages: $languages = array('en' => 'English', 'fr' => 'French', 'de' => 'German'); // Look at the GET string to see if lang is // specified: if (isset($_GET['lang'])) { // It's been specified, so set the language $lang = $_GET['lang']; // While here, send a cookie to remember this // selection for 1 year. setcookie('lang', $lang, time()+(3600*24*365)); } // Ok, otherwise look for the cookie itself: elseif (isset($_COOKIE['lang'])) { // Use this $lang = $_COOKIE['lang']; } else { // Otherwise, default to English $lang = 'en'; } // Make sure that the language string we have is // a valid one: if (!(in_array($lang, array_keys($languages)))) { die("ERROR: Bad Language String Provided!"); } // Now include the appropriate language file: require_once "{$lang}.php" // As one last step, create a function // that can be used to output language // options to the user: function switch_language_options() { // Include a few globals that we will need: global $text, $languages, $lang; // Start our string with a language specific // 'switch' statement: $retval = $text['switch']; // Loop through all possible languages to // create our options. $get = $_GET; foreach ($languages as $abbrv => $name) { // Create the link, ignoring the current one. if ($abbrv !== $lang) { // Recreate the GET string with // this language. $get['lang'] = $abbrv; $url = $_SERVER['PHP_SELF'] . '?' . http_build_query($get); $retval .= " <a href=\"{$url}\"> {$name}</a>"; } } // Now return this string. return $retval; } ?> HELP!
  3. Izpaliidzu comam kuram lapa ir tad nu ciinamies abi galvas salikushi! Vienkaarshi to lapu senum sen saveidoja vinjam tad nu tagad mazliet jaapielabo utt izdomaajaam pacakareeties.
  4. Lapai ir trīs valodas viss skaisti straadaa utt, bet gribu lai teksta vietaa raadiitos bilde katrai valodai, nemaaku uztaisiit, neesmu PHP specs. bet iesaaceejs gribaas arii taa lai links buutu iekhaa! <?php switch ($va){ case "lv": echo("Koks"); break; case "ru": echo("Дерево"); break; case "en": echo("Tree"); break; } ?> Paldies jau ieprieksh!
×
×
  • Create New...