keiby Posted June 18, 2003 Report Share Posted June 18, 2003 veelos izveidot menu uz shaada principa : Menu1 submenu1 submenu2 Menu2 submenu3 submenu4 klikshkjinot uz viena no Menu paraaadaas submenu, bet visi ieprieksheejie (ja ir atveerti) aizveraas. var kaac paliidzeet ? K. Link to comment Share on other sites More sharing options...
CryRat Posted June 19, 2003 Report Share Posted June 19, 2003 tjipa vajag kaut ko lidzigu shitam ? esu redzejis ka taisa kaut ka murgaini un sarezgiti... personigi es uztaisiju shita <code><font color="#000000"> <font color="#0000CC"><? </font><font color="#006600">... echo </font><font color="#CC0000">"<TABLE>n"</font><font color="#006600">; </font><font color="#0000CC">$result </font><font color="#006600">= </font><font color="#0000CC">[url=http://lv.php.net/mysql_query]mysql_query[/url]</font><font color="#006600">(</font><font color="#CC0000">"SELECT `id` FROM `bookmarks` GROUP BY `id`"</font><font color="#006600">); while (</font><font color="#0000CC">$row </font><font color="#006600">= </font><font color="#0000CC">[url=http://lv.php.net/mysql_fetch_array]mysql_fetch_array[/url]</font><font color="#006600">(</font><font color="#0000CC">$result</font><font color="#006600">)) { </font><font color="#0000CC">[url=http://lv.php.net/printf]printf[/url]</font><font color="#006600">(</font><font color="#CC0000">"<TR><TD><A href="</font><font color="#0000CC">bookmarks</font><font color="#006600">.</font><font color="#0000CC">php</font><font color="#006600">?</font><font color="#0000CC">id</font><font color="#006600">=%</font><font color="#0000CC">s</font><font color="#CC0000">" class=caption>%s</A></TD></TR>n"</font><font color="#006600">, </font><font color="#0000CC">$row</font><font color="#006600">[</font><font color="#CC0000">"id"</font><font color="#006600">], </font><font color="#0000CC">$row</font><font color="#006600">[</font><font color="#CC0000">"id"</font><font color="#006600">]); if (</font><font color="#0000CC">$_GET</font><font color="#006600">[</font><font color="#CC0000">"id"</font><font color="#006600">] == </font><font color="#0000CC">$row</font><font color="#006600">[</font><font color="#CC0000">"id"</font><font color="#006600">]) { </font><font color="#0000CC">$bookmarks </font><font color="#006600">= </font><font color="#0000CC">[url=http://lv.php.net/mysql_query]mysql_query[/url]</font><font color="#006600">(</font><font color="#CC0000">"SELECT `name`, `url` FROM `bookmarks` WHERE `id` = '$_GET</font><font color="#006600">[</font><font color="#CC0000">id</font><font color="#006600">]</font><font color="#CC0000">' ORDER BY `name` ASC"</font><font color="#006600">); while (</font><font color="#0000CC">$bookmark </font><font color="#006600">= </font><font color="#0000CC">[url=http://lv.php.net/mysql_fetch_array]mysql_fetch_array[/url]</font><font color="#006600">(</font><font color="#0000CC">$bookmarks</font><font color="#006600">)) { </font><font color="#0000CC">[url=http://lv.php.net/printf]printf[/url]</font><font color="#006600">(</font><font color="#CC0000">"<TR><TD><A target=_blank href=http://%s class=link>>> %s</A></TR></TD>n"</font><font color="#006600">, </font><font color="#0000CC">$bookmark</font><font color="#006600">[</font><font color="#CC0000">"url"</font><font color="#006600">], </font><font color="#0000CC">$bookmark</font><font color="#006600">[</font><font color="#CC0000">"name"</font><font color="#006600">]); } } } echo </font><font color="#CC0000">"</TABLE>n"</font><font color="#006600">; ... </font><font color="#0000CC">?> </font> </font> </code> sorry nav laika tur lieko izvakt bet gan jau sapratisi... enjoy :) Link to comment Share on other sites More sharing options...
keiby Posted June 19, 2003 Author Report Share Posted June 19, 2003 tjipa vajag kaut ko lidzigu shitam ? jap. bet tikai bez sql. ~ tas izskataas taa : <code><font color="#000000"> <font color="#0000CC"><?php </font><font color="#006600">if(isset(</font><font color="#0000CC">$stat</font><font color="#006600">)){ </font><font color="#0000CC">$a </font><font color="#006600">= </font><font color="#0000CC">[url=http://lv.php.net/unserialize]unserialize[/url]</font><font color="#006600">(</font><font color="#0000CC">[url=http://lv.php.net/base64_decode]base64_decode[/url]</font><font color="#006600">(</font><font color="#0000CC">$stat</font><font color="#006600">)); } if(isset(</font><font color="#0000CC">$node</font><font color="#006600">)){ if(!isset(</font><font color="#0000CC">$a</font><font color="#006600">[</font><font color="#0000CC">$node</font><font color="#006600">])){ </font><font color="#0000CC">$a</font><font color="#006600">[</font><font color="#0000CC">$node</font><font color="#006600">]=</font><font color="#0000CC">true</font><font color="#006600">; } else { if(</font><font color="#0000CC">$a</font><font color="#006600">[</font><font color="#0000CC">$node</font><font color="#006600">]==</font><font color="#0000CC">true</font><font color="#006600">){ </font><font color="#0000CC">$a</font><font color="#006600">[</font><font color="#0000CC">$node</font><font color="#006600">]=</font><font color="#0000CC">false</font><font color="#006600">; } else { </font><font color="#0000CC">$a</font><font color="#006600">[</font><font color="#0000CC">$node</font><font color="#006600">]=</font><font color="#0000CC">true</font><font color="#006600">; } } } </font><font color="#0000CC">$stat </font><font color="#006600">= </font><font color="#0000CC">[url=http://lv.php.net/base64_encode]base64_encode[/url]</font><font color="#006600">(</font><font color="#0000CC">[url=http://lv.php.net/serialize]serialize[/url]</font><font color="#006600">(</font><font color="#0000CC">$a</font><font color="#006600">)); echo </font><font color="#CC0000">"<table>"</font><font color="#006600">; echo </font><font color="#CC0000">"<tr><td><a href=$PHP_SELF?stat=$stat&statid=menu1&node=1>+</a></td><td>Menu</td></tr>"</font><font color="#006600">; if(</font><font color="#0000CC">$a</font><font color="#006600">[</font><font color="#0000CC">1</font><font color="#006600">]){ echo </font><font color="#CC0000">"<tr><td>--</td><td>Testing1</td></tr>"</font><font color="#006600">; echo </font><font color="#CC0000">"<tr><td>--</td><td>Testing2</td></tr>"</font><font color="#006600">; } echo </font><font color="#CC0000">"<tr><td><a href=$PHP_SELF?stat=$stat&statid=menu2&node=2>+</a></td><td>Menu2</td></tr>"</font><font color="#006600">; if(</font><font color="#0000CC">$a</font><font color="#006600">[</font><font color="#0000CC">2</font><font color="#006600">]){ echo </font><font color="#CC0000">"<tr><td>--</td><td>Testing3</td></tr>"</font><font color="#006600">; } echo </font><font color="#CC0000">"</table>"</font><font color="#006600">; </font><font color="#0000CC">?></font> </font> </code> bet shajaa gadiijienaa, neveraas ciet ieprieksheejie submenu un tiek pagarinaata adrese ar kaukaadiem debiliem burtiem Link to comment Share on other sites More sharing options...
v3rb0 Posted June 20, 2003 Report Share Posted June 20, 2003 Paskaties fragmentu no viena mana projekta http://paste.php.lv/180 (šeit piemērs it kā darbojās) Link to comment Share on other sites More sharing options...
keiby Posted June 25, 2003 Author Report Share Posted June 25, 2003 thnx. shitais ir tas, kas vajadziix. Link to comment Share on other sites More sharing options...
keiby Posted July 3, 2003 Author Report Share Posted July 3, 2003 nea. tomeer es nevaru piedabuut straadaat savaam vajadziibaam. rekur piemeeru var pastiities delfi.lv navigaacija. uz taadu principu vaig. K. Link to comment Share on other sites More sharing options...
Venom Posted July 3, 2003 Report Share Posted July 3, 2003 Nu es cilvēkus nesaprotu: ņem rokās vairākdimensiju masīvus un aidā! Nevari aizdomāties līdz kaut kam līdzīgam? <?php function g($str) //dabū GET mainīgo, jebšu to, kas nodots caur index.php?var=value { if (!isset($_GET[$str])) $_GET[$str]=''; return $_GET[$str]; } $site=$_SERVER['PHP_SELF']; $_GET['m']=intval(g('m')); $_GET['s']=intval(g('s')); $menu=array('main','info','test'); $submenu=array ( ''=array(), 'main'=>array('links','others','counters'), 'info'=>array('about me','about him'), 'test'=>array('test1') ); for($item=0;$item<=count($menu)-1;$item++) { //izvadām visus menu elementus ar parametru m, kas atbilst el-ta indeksam $menu masīvā echo '<a href="'.$site.'?m='.$item.'">'.$menu[$item].'</a><br>'; //ja ir nodots GET m if (g('m')) { //izvadām attiecīgā $submenu elementus for($sub=0;$sub<=count($submenu[$menu[g('m')]]));$sub++) { echo '<a href="'.$site.'?m='.$item.'&s='.$sub.'">'.$submenu[$menu[g('m')]][$sub].'</a><br>'; } } } pēc tam lapā čeko: switch($menu[g('m')]) //nosakām menu elementu { case 'main': //$menu main switch($submenu['main'][g('s')]) { case 'links': echo 'linku sadaļa'; .... break; default: echo 'Izvēlēta MAIN sadaļa, apaķšdaļa nav izvēlēta'; break; } break; case 'info'://$main info switch($submenu['info'][g('s')]) //izvēlamies tā apakšelementu { case 'links': echo 'linku sadaļa'; .... break; } break; } ?> nav pārliecības, ka switch ņēma preti nenoteiktās vērtības,, bet vienkārši vajadzēs papildus variābli. Īr saprotams princips? Link to comment Share on other sites More sharing options...
keiby Posted July 3, 2003 Author Report Share Posted July 3, 2003 apmeeram skaidrs ir tik daudz cik buutu skaidrs sievietei, kas pirmo reizi pieseedusies pie stuures un instruktors vinjai teiktu : ar labo kaajas purngalu spiezham videejo pedaali, ar papeedis - uzsit pa starpgaazi. 2. robs... griidaa, 3., griidaa, ap 110km/h un naak T-veida kreisais, kuru njemam ar smuku sliidi ... :P ... es tak veel maacos :blink: meegjinaasim urbties cauri ... K. Link to comment Share on other sites More sharing options...
K|NG Posted July 3, 2003 Report Share Posted July 3, 2003 apmeeram skaidrs ir tik daudz cik buutu skaidrs sievietei, kas pirmo reizi pieseedusies pie stuures un instruktors vinjai teiktu : ar labo kaajas purngalu spiezham videejo pedaali, ar papeedis - uzsit pa starpgaazi. 2. robs... griidaa, 3., griidaa, ap 110km/h un naak T-veida kreisais, kuru njemam ar smuku sliidi ... :P ... es tak veel maacos :blink: meegjinaasim urbties cauri ... K. ira arī šitāds padhods ;) skat. linku Link to comment Share on other sites More sharing options...
keiby Posted July 4, 2003 Author Report Share Posted July 4, 2003 ira arī šitāds padhodsskat. linku nedaudz izlaboju un man sanaaca shaadi : menu it kaa jau straadaa, esmu sanjeemis to ko vajag. bet vai taa ir pareizi ? K. Link to comment Share on other sites More sharing options...
K|NG Posted July 5, 2003 Report Share Posted July 5, 2003 nu visādi jau var: http://paste.php.lv/196 Link to comment Share on other sites More sharing options...
Recommended Posts