SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard co.ador's Avatar
    Join Date
    Apr 2009
    Posts
    1,054
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Finding the pointer position.

    Illustration I


    Sneakers (heading)

    1. Nike (subheadings)
    2. Addias
    3. Fila

    Boots
    DressShoes


    The illustration above is and accordion menu, which a users click in a heading and it display its subheadings. The equivalent of that illustration in code is below.

    PHP Code:
    $sql 'SELECT id,Subject FROM menusubjects;'
    $result mysql_query($sql); 

    if(
    $result && mysql_num_rows($result)!=0) { 
         
        echo 
    '<ul id="nav-categories">'
         
        while(
    $row mysql_fetch_assoc($result)) { 
             
            
    $uri 'example1.php?subject='.urlencode($row['id']); 
            
    $class = !is_null($cat) && $cat==$row['id']?' class="selected"':''
             
            echo 
    "\t",'<li',$class,'><a href="',$uri,'">',$row['Subject'].'</a>'
                 
            if(
    $submenu==false && !is_null($cat) && $cat == $row['id']) { // line 58 
                     
                
    $sql2 'SELECT id,shoename FROM regularmenu WHERE menusubject_id = '.mysql_real_escape_string($cat).';'
                
    $result2 mysql_query($sql2); 
                     
                if(
    $result2 && mysql_num_rows($result2)!=0) { 
                         
                    echo 
    "\n\t\t",'<ul class="submenu">',"\n";     
                     
                    while(
    $row2 mysql_fetch_assoc($result2)) { 
                         
                        
    $uri2 $uri.'&menu='.urlencode($row2['id']); 
                        
    $class2 = !is_null($prod) && $prod==$row2['id']?' class="selected"':''
                         
                        echo 
    "\t\t\t",'<li',$class,'><a href="',$uri2,'">',$row2['shoename'],'</a></li>',"\n";                  
                    } 
                     
                    echo 
    "\t\t",'</ul> <!-- end of ul.submenu -->',"\n";                         
                }                 
                
    $submenu true;             
            }              
            echo 
    '</li>',"\n";       
        }      
        echo 
    '</ul> <!-- end of ul#nav-categories -->',"\n 
    The code above shows two queries one for the headings and another for the subheadings and both use a while loop etc.

    My question is where the pointer is when a user click on the headings Sneakers causing to open it's three subheadings NIke, Adidas and Fila.

    Where is the pointer at the beginning of the code or somewhere in the middle or at the end?

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,147
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    What do you mean by pointer? The applications state is being passed between requests through the $_GET vars. Pointer???

  3. #3
    SitePoint Wizard co.ador's Avatar
    Join Date
    Apr 2009
    Posts
    1,054
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok It is by request ok, I thought there was a pointer that were going through the applications and it was performing it by order. I was mistaken.

    Oddz you can visit this post

    http://www.sitepoint.com/forums/showthread.php?t=616863

    there I explain more clear what I was trying to achieve with this poing.

    Now I know it is by request. I have a question those the request are made by the order of the application or by position in the page?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •