m0zus Posted November 23, 2006 Report Share Posted November 23, 2006 (edited) Tātad tā, sāksim ar to ka es neesmu ļoti gudrs php, tapec varbut uzrakstīšu mazliet neskaidri.. Es gribu ielikt saitā valodas izvēli (piem 2 valodas- angļu un latviešu). Saitam ir include faili (piem. eng.php, lat.php). defaultā vajadzētu stāvēt lat.php, bet tiem kas uzspiež eng(piem uz bildītes), tiem tas nomainas uz - eng.php + vēl tas saglabājas cookijos lai tas darbojas visās lapās un paliek arī kad nākamreiz ienāk saitā... Ja arī te saputroti uzrakstiju, cerēsim ka sapratāt. Lūdzu, kāds var palīdzēt (izveidot skriptu, vai pateikt kur kada pamaciba)? Izmeklejos googlee, bet neka neatradu :/ Edited November 23, 2006 by m0zus Link to comment Share on other sites More sharing options...
andrisp Posted November 23, 2006 Report Share Posted November 23, 2006 Tu jau pats uzrakstīji, kas jādara. Kur problēma ? Link to comment Share on other sites More sharing options...
m0zus Posted November 23, 2006 Author Report Share Posted November 23, 2006 Probleema ir taada, ka es to nemaaku izdariit! Link to comment Share on other sites More sharing options...
andrisp Posted November 23, 2006 Report Share Posted November 23, 2006 Nu tad jāmācās :). Link to comment Share on other sites More sharing options...
Delfins Posted November 23, 2006 Report Share Posted November 23, 2006 http://alistapart.com/articles/phpswitch/ Link to comment Share on other sites More sharing options...
m0zus Posted November 23, 2006 Author Report Share Posted November 23, 2006 Nu tad jāmācās :). Cenhos! Tapec jau mekleeju :) Link to comment Share on other sites More sharing options...
m0zus Posted November 23, 2006 Author Report Share Posted November 23, 2006 Labi, ar sessijam esmu atkodis kaa to dariit, bet kaa ar cookijiem nesaprotu. Kads butu tik labinsh un palidzetu man?? Link to comment Share on other sites More sharing options...
andrisp Posted November 23, 2006 Report Share Posted November 23, 2006 http://www.google.lv/search?hl=lv&q=php+cookies Link to comment Share on other sites More sharing options...
m0zus Posted November 23, 2006 Author Report Share Posted November 23, 2006 (edited) Atvainojos par DoublePostu, nokaaraas inets Edited November 23, 2006 by m0zus Link to comment Share on other sites More sharing options...
m0zus Posted November 23, 2006 Author Report Share Posted November 23, 2006 Hmm. Itkaa kautko izveidoju, bet probleema taada, ka visu laiku ir tikai LV valoda.. spied uz English bet tapat LV :/ <html> <body> <A HREF="" onClick="<?php setcookie("lang_test", "eng", time()+3600)?>">English</A> | <A HREF="" onClick="<?php setcookie("lang_test", "lv", time()+3600) ?>">Latvian</A><br> <? if (isset($_COOKIE["lang_test"])) include("valodas/val_" . $_COOKIE["lang_test"] . ".php"); else include("valodas/val_eng.php"); ?> <? echo $text1; ?> </body> </html> Link to comment Share on other sites More sharing options...
andrisp Posted November 23, 2006 Report Share Posted November 23, 2006 Nu bet protams - tu jau savā skriptā nepārbaudi vai lang_test ir lv vai eng, bet gan vai viņš ir uzsetots (php.net/isset). Link to comment Share on other sites More sharing options...
m0zus Posted November 23, 2006 Author Report Share Posted November 23, 2006 Nee, tur nav taa lieta.. Spied cik gribi- cookijs nemainaas.. <A HREF="" onClick="<?php setcookie("lang_test", "eng", time()+3600)?>">English</A> | <A HREF="" onClick="<?php setcookie("lang_test", "lv", time()+3600) ?>">Latvian</A><br> a ja uztaisu vienkarshu lapu <? setcookie("lang_test", "eng", time()+3600); ?> tad cookijs mainaas.. kapeec taa? varbuut vaig savadak to linku? Link to comment Share on other sites More sharing options...
v3rb0 Posted November 23, 2006 Report Share Posted November 23, 2006 onclick tev neizpilda to php gabalu. palasi par klients/serveris.. Link to comment Share on other sites More sharing options...
andrisp Posted November 23, 2006 Report Share Posted November 23, 2006 :) tik tagad vispār piefiksēju, ka tu mēģini php kodu izpildīt iekš onclick eventa. Nu nevar tā. Php ir servera puses valoda. Link to comment Share on other sites More sharing options...
blackhalt Posted November 23, 2006 Report Share Posted November 23, 2006 http://bh.deals.lv/source/cookie.php Link to comment Share on other sites More sharing options...
Recommended Posts