daviskrex Posted July 15, 2007 Report Share Posted July 15, 2007 2h meklēju pamācības kā uztaisīt linkus, kas izskatas šādi: site.com/index.php?id=1 bet diemžēl neko neatradu, varbūt varat palīdzēt un izskaidrot kā īsti jāveido šādi triki =] Jau iepriekš pateicos , Daviskrex. Link to comment Share on other sites More sharing options...
Norek Posted July 15, 2007 Report Share Posted July 15, 2007 site.com/index.php?id=1 bet diemžēl neko neatradu, varbūt varat palīdzēt un izskaidrot kā īsti jāveido šādi triki =] Jau iepriekš pateicos , Daviskrex. switch (id) { case "1": echo "cūka"; $title = "lohs"; break; case "2": echo "govs"; break; default : echo "suns"; } karoč lv.php.net meklē keywordu switch. tur ir vairāki piemēri. Link to comment Share on other sites More sharing options...
worm Posted July 15, 2007 Report Share Posted July 15, 2007 switch(@$_REQUEST['id']) Link to comment Share on other sites More sharing options...
daviskrex Posted July 15, 2007 Author Report Share Posted July 15, 2007 nu kā piemēram ja man ir <?php switch ($_GET['go']) { case "1": $inc = 'Page01.php'; break; case "2": $inc = 'Page02.php'; break; case "3": $inc = 'Page03.php'; break; case "4": $inc = 'Page04.php'; break; default: $inc = 'Page01.php'; break; } include ($inc); ?> tad bus lapa.lv/index.php?go=1 vaine? Link to comment Share on other sites More sharing options...
staly Posted July 15, 2007 Report Share Posted July 15, 2007 jaa! Link to comment Share on other sites More sharing options...
daviskrex Posted July 15, 2007 Author Report Share Posted July 15, 2007 (edited) o! paldies ! u are the best! =] edit: cik skatos kautkas tomēr nav tā. Edited July 15, 2007 by daviskrex Link to comment Share on other sites More sharing options...
staly Posted July 15, 2007 Report Share Posted July 15, 2007 iedod screen! Link to comment Share on other sites More sharing options...
daviskrex Posted July 15, 2007 Author Report Share Posted July 15, 2007 še! Link to comment Share on other sites More sharing options...
Norek Posted July 15, 2007 Report Share Posted July 15, 2007 (edited) kur Tev ir ? include($inc); EDIT: iesaku lietot vlib template engine lai būtu html un php faili, nevis viss vienā miskastē. es lietoju un man patīk. un tad vēl iesaku lietot EditPlus, kas varētu atvieglot Tava koda pārskatāmību. EditPlus ir ftp ready. Vari editēt failus pa taisno, ja tie atrodas uz kāda ftp servera. EDIT #2: Vari pameklēt internetā PEAR extras, kas ir definētas f-ijas kā getString(); , kas varētu ievērojami atvieglot datu pieprasījumu, bet tas tā, ja ir interese. Edited July 15, 2007 by n0r3k Link to comment Share on other sites More sharing options...
staly Posted July 15, 2007 Report Share Posted July 15, 2007 uztaisi tos failus index02.php ieraksti iekssaa kautko!! un tad index.php?id=1 Link to comment Share on other sites More sharing options...
worm Posted July 15, 2007 Report Share Posted July 15, 2007 kamoon, te ozh peec vajadziibas palasiit "A Programmer's Introduction to PHP" es LJOTI rekomendeju izlasiit (un ja ir iespeja - izdrukaat) to linku ko iedevu, es to gramatu nopirku un man vinja vel shobaltdien staav plauktaa... tiesham zelta veerta... Link to comment Share on other sites More sharing options...
daviskrex Posted July 16, 2007 Author Report Share Posted July 16, 2007 njaa iespaidīgi, 400 lapas pusēs aprakstītas visas php funkcijas, turklāt ar visiem piemeriem u.c. paldies! =] Link to comment Share on other sites More sharing options...
Kavacky Posted July 17, 2007 Report Share Posted July 17, 2007 Jūs analfabēti, cilvēks prasa kā uztaisīt linku, nevis ko ar GET variabļiem darīt. "<a href="site.com/index.php?id=1">blablabla</a>" should do the trick. A es gan templeišu endžinus neiesaku lietot, jo PHP PATS PAR SEVI IR TEMPLATE ENGINE. Link to comment Share on other sites More sharing options...
Norek Posted July 17, 2007 Report Share Posted July 17, 2007 A es gan templeišu endžinus neiesaku lietot, jo PHP PATS PAR SEVI IR TEMPLATE ENGINE. Tu pats īsti neesi sapratis. Izlasi viņa pašu pirmo teikumu pirmajā postā. Kā uztaisīt, lai izskatās. Link to comment Share on other sites More sharing options...
Kavacky Posted July 17, 2007 Report Share Posted July 17, 2007 Es ļoti sapratu, kas tur rakstīts un principā arī to, ko viņš gribēja noskaidrot. Bet "uztaisīt linku" ir sacept HTMLu, kurš uz tādu vietu aizved, ne? Nevis implementāciju tam, kā ar padotajiem datiem kaut ko tālāk realizē. Link to comment Share on other sites More sharing options...
daviskrex Posted July 17, 2007 Author Report Share Posted July 17, 2007 (edited) OMG. linkus jau katrs maak uzraxtiit, bet es gribeju zinat kaa izveidot adreses paplasinajumus or something..... vienkarsak sakot man vajadzeja zinat ka izveidot tieshi sho partu: ?id=1 P.S. sry Tilde nokaras =] Edited July 17, 2007 by daviskrex Link to comment Share on other sites More sharing options...
10BaseT Posted July 17, 2007 Report Share Posted July 17, 2007 <?php switch($_GET['id']) { // Piemēram adrese būs ?id= case "1": // Ja ID ir 1 echo "ID ir 1"; break; case "2": // Ja ID ir 2 echo "ID ir 2"; break; case "3": // Ja ID ir 3 echo "ID ir 3"; break; default: //Ja ID nesatur nevienu no norādītajiem skaitļiem: 1,2,3 tad tas būs 5 echo "ID ir 5"; break; } ?> Link to comment Share on other sites More sharing options...
Kavacky Posted July 18, 2007 Report Share Posted July 18, 2007 Tā nav īsti smuki. Pārveidojam, lai nemet Notice par Undefined index. <?php isset($_GET['id']) ? $id = $_GET['id'] : $id = 5; // Ja id nemaz nav padots, uzliekam kaut kādu default vērtību switch($id) { case "1": // Ja ID ir 1 echo "ID ir 1"; break; case "2": // Ja ID ir 2 echo "ID ir 2"; break; case "3": // Ja ID ir 3 echo "ID ir 3"; break; default: //Ja ID nesatur nevienu no norādītajiem skaitļiem: 1,2,3 tad tas būs 5 echo "ID ir 5"; break; } ?> Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now