sandrulis Posted December 9, 2008 Report Share Posted December 9, 2008 Kāds varetu izskatiities skripts, kurš saglabaa cookie-os? Piemeram es uzspiezu lai nomainas no lv uz rus (viss ok, valoda straadaaa), bet kad uzspiezu uz linku un aizeju tur jau atkal ir lv valoda! Link to comment Share on other sites More sharing options...
Aleksejs Posted December 9, 2008 Report Share Posted December 9, 2008 Apmēram šitā: <?php ob_start(); if(array_key_exists('valoda',$_COOKIE)){ switch($_COOKIE['valoda']){ case 'EN': $valoda='EN'; break; case 'GR': $valoda='GR'; break; default: $valoda='LV'; } } else { setcookie('valoda','LV'); $valoda='LV'; } if(array_key_exists('valoda',$_GET)){ switch($_GET['valoda']){ case 'EN': $valoda='EN'; break; case 'GR': $valoda='GR'; break; default: $valoda='LV'; } setcookie('valoda',$valoda); } } ob_flush(); ?> Link to comment Share on other sites More sharing options...
sandrulis Posted December 9, 2008 Author Report Share Posted December 9, 2008 LIELS PALIDES Link to comment Share on other sites More sharing options...
Aleksejs Posted December 9, 2008 Report Share Posted December 9, 2008 Lūdzu! Protams, var vēl optimizēt utt, bet iesākumam, cerams, ka saprotams. Link to comment Share on other sites More sharing options...
sandrulis Posted December 9, 2008 Author Report Share Posted December 9, 2008 SRY, bet es iesācējs :( bet protams, ne pirmo reizi ar pīpi uz jumta! nevari palīdzet, viss ok , ar valodu ir itka ok, bet kadas izskataas links lai pārslēgtos? Link to comment Share on other sites More sharing options...
Val Posted December 9, 2008 Report Share Posted December 9, 2008 <a href="?valoda=EN">en</a> <a href="?valoda=GR">gr</a> <a href="?valoda=LV">lv</a> Link to comment Share on other sites More sharing options...
Recommended Posts