millers Posted March 14, 2008 Report Share Posted March 14, 2008 Velos dabuti code kad piemeram uzspiezot uz Home button augsa pie weba adresees radas www.webs.lv/index.php?kkas=home nevis www.webs.lv/index.php ludzu iedodiet code thx jau ieprieks !! Link to comment Share on other sites More sharing options...
Zandis Murāns Posted March 14, 2008 Report Share Posted March 14, 2008 <form action="index.php" method = "GET"> <input type="hidden" name="kkas" value="Home"/> <input type="submit" value="Home"/> </form> Link to comment Share on other sites More sharing options...
millers Posted March 14, 2008 Author Report Share Posted March 14, 2008 a vajtad ari php cods nebija kkads tur ar get ??? jo sitas iskatas tads divains jo ja piemeram es veletos sev menu salikti tad man tadi vairaki jataisa tie code a ar php code butu vieglak !! man ta liekas !! Link to comment Share on other sites More sharing options...
Zandis Murāns Posted March 14, 2008 Report Share Posted March 14, 2008 Bļa, tu sit mani nost, bet es nespēju iebraukt, ko nafig tu gribi, lai arī tu atgādini mani pašu. Link to comment Share on other sites More sharing options...
777 Posted March 14, 2008 Report Share Posted March 14, 2008 if ($_GET['kkas']) { // tavs kods .... } Link to comment Share on other sites More sharing options...
millers Posted March 14, 2008 Author Report Share Posted March 14, 2008 es velos tadu lietu ka lai paskaidro kr4 moska sapratisi mosk ne kr4 piemeram ta lai kad spiez uz link piemeram login links lai augsa pie web adreses neradss www.webs.lv/login.php bet gan lai radas www.webs.lv/index.php?tag=login luuk sadi un man vajaga to code .. Link to comment Share on other sites More sharing options...
Val Posted March 14, 2008 Report Share Posted March 14, 2008 (edited) <a href="www.webs.lv/index.php?kkas=home">home button pie pie weba adreses</a> Edited March 14, 2008 by Val Link to comment Share on other sites More sharing options...
777 Posted March 15, 2008 Report Share Posted March 15, 2008 tad izmanto mod_rewrite lai piem. butu www.tavalapa.lv/zinas/1/ bet ista adrese bus www.tavalapa.lv/zinas.php?nid=1 .... tas tikai piemers ... Link to comment Share on other sites More sharing options...
marcis Posted March 15, 2008 Report Share Posted March 15, 2008 Atradi, kam stāstīt par mod_rewrite, turklāt viņš pieprasija tieši GET. Link to comment Share on other sites More sharing options...
none Posted March 15, 2008 Report Share Posted March 15, 2008 (edited) Kāda problēma tam linkam "Home" pamainīt adresi no "www.webs.lv/index.php" uz "www.webs.lv/index.php?kkk=home"? Tas ko tu gribi varētu izskatīties šādi - <a href="www.webs.lv/index.php?tag=home">Home</a> <a href="www.webs.lv/index.php?tag=login">Login</a> Līdz ar to fails "login.php" tev būs jāiekļauj tavā index.php failā Index.php if(isset($_GET['tag']) && $_GET['tag'] == 'login') { include('login.php'); // protams norādi īsto ceļu } Edited March 15, 2008 by none Link to comment Share on other sites More sharing options...
millers Posted March 15, 2008 Author Report Share Posted March 15, 2008 if(isset($_GET['tag']) && $_GET['tag'] == 'login') { include('inc/erroru.php'); } if(isset($_GET['tag']) && $_GET['tag'] == 'Reg') { include('reg/register.php'); } Sadi es driktsu dariti ? Link to comment Share on other sites More sharing options...
Zandis Murāns Posted March 15, 2008 Report Share Posted March 15, 2008 Drīksti, bet labāk šitā: if(isset($_GET['tag']) && $_GET['tag'] == 'login') include('inc/erroru.php'); elseif(isset($_GET['tag']) && $_GET['tag'] == 'Reg') include('reg/register.php'); Link to comment Share on other sites More sharing options...
bubu Posted March 15, 2008 Report Share Posted March 15, 2008 Tieši tā nav labāk. Kods grūtāk lasās un ir grūtāk uzturams. Ieliksi papildus kodu aiz viena no include's un nepieliks figūriekavas - dabūsi nepareizu koda izpildīšanos. Palasi koda rakstīšanas laba stila ieteikumus. Figūriekavas vajag visur rakstīt - arī vienam pašam steitmentam (attiecas gan uz if, gan for, gan while, gan funkcijām, utt...) Daudz labāk būtu izmantot asociatīvo masīvu: $pages = array("Reg" =>"reg/register.php", "login" => "inc/erroru.php", ...); if (isset($_GET['tag']) && array_key_exists($_GET['tag'], $pages)) { include($pages[$_GET['tag']]); } else { // nav tādas lapas. } Link to comment Share on other sites More sharing options...
millers Posted March 15, 2008 Author Report Share Posted March 15, 2008 <a class="hilight" title="Home" href="http://ip/uo/index.php?tag=home">Home</a> <br> <a class="hilight" title="Login" href="http://ip/uo/index.php?tag=login">Login</a> <br> <a class="hilight" title="Registracija" href="http://ip/uo/index.php?tag=reg">Registracija</a> if(isset($_GET['tag']) && $_GET['tag'] == 'login') include('inc/erroru.php'); elseif(isset($_GET['tag']) && $_GET['tag'] == 'Reg') include('reg/register.php'); man ir luk sadi bet kad spiezu uz registracija nekas nenotiek bet kad spiezu uz login viss notiek Link to comment Share on other sites More sharing options...
bubu Posted March 15, 2008 Report Share Posted March 15, 2008 Atšķirību starp "Reg" un "reg" redzi? Link to comment Share on other sites More sharing options...
Recommended Posts