ziedinjsh Posted October 24, 2009 Report Share Posted October 24, 2009 (edited) Sveiki, man tāds jautājums. Ja man ir šāda izvēlne $page = (isset($_GET['page'])) ? $_GET['page'] : ''; echo "<a href='index.php'>Home</a>"; echo "<a href='index.php?page=info'>Info</a>"; echo "<a href='index.php?page=something'>Something</a>"; if($page == 'info'){ include "kkas.php"; } if($page == 'something'){ include "kkas2.php"; } kā lai es uztaisu lai rāda current.. es uzspiežu uz info un viņš paliek piem. bold vai kaut kā tā.. tas nebūtu tik svarīgi bet kā lai uztaisa to kad viņš rāda tagad atvērto sadaļu? Paldies jau iebriekš! :) Edited October 24, 2009 by ziedinjsh Quote Link to comment Share on other sites More sharing options...
briedis Posted October 24, 2009 Report Share Posted October 24, 2009 Reāli, tu pats tiešām nevari izdomāt, kā to izdarīt? Nevari izštukot, ka vajag vienkārši attiecīgajā vietā pārbaudīt, vai nav izvēlēta attiecīga sadaļa un tad to attēlot? Quote Link to comment Share on other sites More sharing options...
Val Posted October 24, 2009 Report Share Posted October 24, 2009 echo "<a href='index.php?page=info'".($page=="info"?" class='current'":"").">Info</a> "; current stilu definē pats. Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted October 24, 2009 Author Report Share Posted October 24, 2009 (edited) Paldies! :) šitā es nebiju iedomājies, bet nu neiet kaut kā. CSS: /* menu */ .menu{ border:1px solid #000000; float:left; padding:5px; margin-right:1px; font-size:20px; font-family:arial; font-weight:bold; cursor:pointer; color:#000000; } .menu:hover{ background-color:#000000; color:#ffffff; } .current{ background-color:#000000; color:#cccccc; } PHP $page = (isset($_GET['page'])) ? $_GET['page'] : ''; echo "<div onclick=\"location.href='index.php';\" class='menu' ".($page==""?" class='current'":"").">Sākums</div>"; echo "<div onclick=\"location.href='index.php?page=about';\" class='menu' ".($page=="about"?" class='current'":"").">Par mums</div>"; echo "<div onclick=\"location.href='index.php?page=biography';\" class='menu' ".($page=="biography"?" class='current'":"").">Biogrāfija</div>"; echo "<div onclick=\"location.href='index.php?page=contacts';\" class='menu' ".($page=="contacts"?" class='current'":"").">Kontakti</div>"; if ($page==''){ include "page.php"; } if ($page=='about'){ include "about.php"; } if($page=='biography'){ include "biography.php"; } if($page=='contacts'){ include "contacts.php"; } uzspiežot uz linku current nenostrādā.. Edited October 24, 2009 by ziedinjsh Quote Link to comment Share on other sites More sharing options...
waplet Posted October 24, 2009 Report Share Posted October 24, 2009 a ko inklūdos, ja būs nepareizs :? Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted October 24, 2009 Author Report Share Posted October 24, 2009 nesapratu? tu domāji šeit?? if ($page=='about'){ include "about.php"; } būs šitā: if ($page=='about'){ include "about.php"; }else{ echo "Page not found"; } Bet man vairāk interesē kapēc tas current nestrādā! :? Quote Link to comment Share on other sites More sharing options...
waplet Posted October 24, 2009 Report Share Posted October 24, 2009 izņem tos $page no {} iekavām Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted October 24, 2009 Author Report Share Posted October 24, 2009 nesaprotu Quote Link to comment Share on other sites More sharing options...
waplet Posted October 24, 2009 Report Share Posted October 24, 2009 echo "<div onclick=\"location.href='index.php?page=about';\" class='menu' ".$page=="about"?" echo class='current'":"".">Par mums</div>"; Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted October 24, 2009 Author Report Share Posted October 24, 2009 viņš kko nenoslēdz.. rādās lapā >Sākums>Par mums>Biogrāfija Quote Link to comment Share on other sites More sharing options...
waplet Posted October 24, 2009 Report Share Posted October 24, 2009 $page=="about"?"echo class='current';":"" Quote Link to comment Share on other sites More sharing options...
Val Posted October 24, 2009 Report Share Posted October 24, 2009 bļin, tur labākajā gadījumā sanāk divas class pēc kārtas... tb class="menu" class="current" echo "<div onclick=\"location.href='index.php?page=about';\" class='menu".($page=='about'?" current":"")."'>Par mums</div>"; Quote Link to comment Share on other sites More sharing options...
waplet Posted October 24, 2009 Report Share Posted October 24, 2009 var jau būt divas klases Quote Link to comment Share on other sites More sharing options...
Val Posted October 24, 2009 Report Share Posted October 24, 2009 (edited) salīdzini atšķirību. <style type="text/css"> .x { color:red;} .y { font-weight:bold;} </style> <p class="x" class="y">qwerty</p> <p class="x y">qwerty</p> Jebkurā gadījumā, abi nav labākais variants priekš menu. Edited October 24, 2009 by Val Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted October 24, 2009 Author Report Share Posted October 24, 2009 kāds tad būtu labāks risinājums prekš menu? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.