andrisp Posted March 25, 2008 Report Posted March 25, 2008 Bet tev taču tur jau ir IFi. Kā tos izdomāji ? Vai arī nokopēji kaut kur nemaz nezinot, kā tas strādā ?
777 Posted March 25, 2008 Report Posted March 25, 2008 domajams kljuda atrodas sheit <?php if(isset($_GET['tag']) && $_GET['tag'] == 'login') { include('inc/erroru.php'); } elseif(isset($_GET['tag']) && $_GET['tag'] == 'Reg') { include('reg/register.php'); } elseif(isset($_GET['tag']) && $_GET['tag'] == 'home') { include('index.php'); } elseif(isset($_GET['tag']) && $_GET['tag'] == 'bug') { include('bugfix.php'); } elseif(isset($_GET['tag']) && $_GET['tag'] == 'sms') { include('inc/erroru.php'); } elseif(isset($_GET['tag']) && $_GET['tag'] == 'about') { include('about.php'); } elseif(isset($_GET['tag']) && $_GET['tag'] == 'contact') { include('contact.php'); } elseif(isset($_GET['tag']) && $_GET['tag'] == 'download') { include('download.php'); } elseif(isset($_GET['tag']) && $_GET['tag'] == 'video') { include('video.php'); } elseif(isset($_GET['tag']) && $_GET['tag'] == 'muzika') { include('muzika.php'); } ?>
millers Posted March 25, 2008 Author Report Posted March 25, 2008 nee tos if man draugs uzrakstiija un es saprotu ko tas nozime skriptus es saprotu ko nozime bet pats vell laaaga nemaku vinjus rakstiiiti ...
Grey_Wolf Posted March 25, 2008 Report Posted March 25, 2008 (edited) labak sadi switch (trim($_GET['tag'])) { case 'bla1': $contents='bla1.php'; $virsraksts='BLA1'; break; case 'bla2': $contents='bla2.php'; $virsraksts='BLA2'; break; // turpini case: 'aa' ... break; cik nepieciesams default: shis izpildisies ja nebuus nekas padots ar get, vai arii netiks atrasta sakritiba tb. varetu buut pirmaa lapa.... $contents='bla.php'; $virsraksts='BLA'; } ?> HTMLs ...... te teiksim virsraksts ... vai kas cits <?php echo $virsraksts; ?> atkal HTML <?php include($contents); ?> ... turpinas HTML Shadi bus daudz parskatamak un arii vairak vai mazak PHP atdaliits no HTML ... ka arii ir taads nerakstiits likums ja iespeju vairak par 5-6 tad izmanto Switch konstrukciju .... Edit: es saprotu ko tas nozime skriptus es saprotu ko nozime bet pats vell laaaga nemaku vinjus rakstiiiti ... tas ir kaa nemaki , ja saproti ? if(ja nosacijums ir patiess) { } else // ja nosacijums nav patiess... { } -- > ta tava konstrukcija nav nekas cits kaa shiis pats tikai salikts rindinjaa... Edited March 25, 2008 by Grey_Wolf
777 Posted March 25, 2008 Report Posted March 25, 2008 (edited) es tev paradiju kur var but kljuda, jebkursh ifinsh atdalas ar { } if() { } elseif() { } Edited March 25, 2008 by 777
Grey_Wolf Posted March 25, 2008 Report Posted March 25, 2008 jebkursh ifinsh atdalas ar { } Nee nepatiess apgalvojums jo: if($a==false) echo 'shis izpildaas'; else echo 'shiss Neizpildiisies'; Ar {} atdalas ja ir vairak kaa viena rindinja tb. koda bloks ....
millers Posted March 25, 2008 Author Report Posted March 25, 2008 soory bet tagad bisku nesapratu .. ko tad man isti dariiti itka es tavu Grey_Wolf ideju ietesteju bet ka spiezu uz link neko netvera...
777 Posted March 25, 2008 Report Posted March 25, 2008 bubu :) ja vinam draugs sarakstija ifus ;) doma vinsh saprata , ko tu tagad vinam rekomendeji ?
Grey_Wolf Posted March 25, 2008 Report Posted March 25, 2008 millers --> tas mans kods izpildes zinja netskjiras no taa ieprieksejaa, vienkarshi parskatamaks un eertaaks (vieglak modificet utt...) takaa meklee vien kur tev ir kljuudas, kaa arii iesleedz arror reportingu .... P.S. aiz defolt: vari ielikt kautvai echo 'aaa nekas netika atrasts'; ;)
millers Posted March 25, 2008 Author Report Posted March 25, 2008 kr4 rekur mans get file ..\ \ http://paste.php.lv/7050 rekur ka es uz link izvadu .. <a class="hilight" title="video" href="http://ability-uo.sytes.net/uo/?tag=video">Video</a> <a class="hilight" title="muzika" href="http://ability-uo.sytes.net/uo/?tag=muzika">Muzika</a>
marcis Posted March 25, 2008 Report Posted March 25, 2008 (edited) Nu varbūt pamēģini arī izvadīt $contents un $virsraksts ? EDIT: vai arī inklūdot Edited March 25, 2008 by marcis
Recommended Posts