Tutorials
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOtherTutorials

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old November 15th, 2005, 01:58 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
navigation Problem

Hi
I am using the bulletlist navigation on my website. I use two $_GET variables for my gallery (site=fotos&fotos=1).
The first one loads the file and the second one loads the path where the images are stored. the file is always the same. The Problem is that the navigation always closes after clicking on a gallery link. What could i do to change that?
Thanks

php Code:
Original - php Code
  1.  
  2. <?php
  3. // Javascript Teil
  4.     echo "        function toggle(id) {n";
  5.     echo "            if(document.getElementById) {n";
  6.     echo "            var el = document.getElementById(id);n";
  7.     echo "            el.style.display = (el.style.display == 'none') ? 'block' : 'none';n";
  8.     echo "            }n";
  9.     echo "        }n";
  10.  
  11. // Menu array
  12.     $fotos = array();
  13.     $fotos['Main']                                =    'index2.php?site=fotos&fotos=1';
  14.     $fotos['menu1']['sub1']['pos1']                =    'index2.php?site=fotos&fotos=2';
  15.     $fotos['menu1']['sub1']['pos2']                =    'index2.php?site=fotos&fotos=3';
  16.     $fotos['menu1']['sub2']['pos1']                =    'index2.php?site=fotos&fotos=4';
  17.     $fotos['menu2']['sub1']['pos1']                =    'index2.php?site=fotos&fotos=5';
  18.    
  19. //Menu
  20.     function array_search_recursive($needle, $haystack) {
  21.         $pos = null;
  22.         $keys = array_keys($haystack);
  23.         while(!$pos && (list($garbage, $value)=each($keys))) {
  24.             if(is_scalar($haystack[$value])) {
  25.                 if($haystack[$value] === $needle)
  26.                     $pos[] = $value;
  27.             } elseif(is_array($haystack[$value])) {
  28.                 if($pos = array_search_recursive($needle, $haystack[$value]))
  29.                     array_unshift($pos, $value);
  30.             }
  31.         }
  32.         return $pos;
  33.     }
  34.     function draw_menu($fotos, $preserve, &$id) {
  35.         if($id == 0)
  36.             echo "<div id="$id">rn<ul class="menu">rn";
  37.         else
  38.             echo "<div id="$id" style="display:none;">rn<ul class="menu">rn";
  39.             $id += 1;
  40.         foreach($fotos as $key=>$value) {
  41.             if(is_array($value)) {
  42.                 if(@in_array($key, $preserve))
  43.                     $toggle = $id;
  44.                     echo "<li class="menu"><a class="menu" href="#" onclick="toggle($id);">$key</a></li>rn";
  45.                     draw_menu($value, $preserve, $id);
  46.             } else {
  47.                 echo "<li class="menufile">";
  48.                 if(@in_array($key, $preserve))
  49.                     echo "<a class="menulive" href="$value">$key</a>";
  50.                 else
  51.                     echo "<a class="menu" href="$value">$key</a>";
  52.                     echo "</li>rn";
  53.                 }
  54.         }
  55.         echo "</ul>rn</div>rn";
  56.         if(isset($toggle))
  57.             echo "<script language="javascript">toggle($toggle);</script>rn";
  58.     }
  59.     $id = 0;
  60.     $base = basename($_SERVER['PHP_SELF']);
  61.     $self = isset($_SERVER['QUERY_STRING']) ? $base.'?'.$_SERVER['QUERY_STRING'] : $base;
  62.     $preserve = array_search_recursive($self, $fotos);
  63.     draw_menu($fotos, $preserve, $id);
  64. ?>

Reply With Quote
Reply

Viewing: Codewalkers ForumsOtherTutorials > navigation Problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT