Set default tab

Discussion in 'PHP' started by aristona, Jun 14, 2010.

  1. #1
    Hi there,

    I have a tab menu for my website, with 4 tabs. It's working properly but it gives a whole list of the content of the 4 categories in stead of the content of 1 tab. I would like to set the default tab, so if you click on each tab you will get only the content of that tab.

    In your browser you must see ?style=default#tab-pop, but how can I do this in PHP? I've absolutely no knowledge on this, so if you can help me I would be very grateful!

    Here's the code:

    <ul class="Tabs">          
                    <li class="popular"><a href="#tab-pop"><?php _e('Popular', 'themes'); ?></a></li>
                    <li class="latest"><a href="#tab-latest"><?php _e('Latest', 'themes'); ?></a></li>
                    <li class="comments"><a href="#tab-comm"><?php _e('Comments', 'themes'); ?></a></li>
                    <li class="tags"><a href="#tab-tags"><?php _e('Tags', 'themes'); ?></a></li>
                </ul>
                
                <div class="clear"></div>
                
                <div class="boxes box inside">
                            
                    <ul id="tab-pop" class="list">            
                        <?php if ( function_exists('tabs_popular') ) tabs_popular($number, $thumb_size); ?>                    
                    </ul>
                
                    <ul id="tab-latest" class="list">
                        <?php if ( function_exists('tabs_latest') ) tabs_latest($number, $thumb_size); ?>                    
                    </ul>	
                
                    <ul id="tab-comm" class="list">
                        <?php if ( function_exists('tabs_comments') ) tabs_comments($number, $thumb_size); ?>                    
                    </ul>	
                    
                    <div id="tab-tags" class="list">
                        <?php tag_cloud('smallest=12&largest=20'); ?>
                    </div>
                    
                </div><!-- /.boxes -->
    			
            </div><!-- /Tabs -->
        
             <?php
       }
    
       function update($new_instance, $old_instance) {                
           return $new_instance;
       }
    
       function form($instance) {                
           $number = esc_attr($instance['number']);
           $thumb_size = esc_attr($instance['thumb_size']);
    	   
           ?>    
           <p>
           <label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of posts:','themes'); ?>
           <input class="widefat" id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" />
           </label>
           </p>  
           <p>
           <label for="<?php echo $this->get_field_id('thumb_size'); ?>"><?php _e('Thumbnail Size (0=disable):','themes'); ?>
           <input class="widefat" id="<?php echo $this->get_field_id('thumb_size'); ?>" name="<?php echo $this->get_field_name('thumb_size'); ?>" type="text" value="<?php echo $thumb_size; ?>" />
           </label>
           </p>  
           <?php 
       }
    
    } 
    ?>
    PHP:
     
    aristona, Jun 14, 2010 IP
  2. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
    #2
    PHP can't access anything behind the # in the url. Javascript can so you might want to go to that forum to get advice.
     
    stephan2307, Jun 15, 2010 IP
  3. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
    #3
    @roopajyothi

    Why do you always post what other people have already said? Over and over again you are posting pretty much the same as people before you. Do you really think that this is productive?
     
    stephan2307, Jun 15, 2010 IP