SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,157
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Post How can i display to link to my Div

    Is this possible,i have 2 divs,in leftside and in right side,in my leftside Div i have 3 links as my menu and i want that if i want to click on each link it will load to my second Div which is in Right side Div.i hope someone help me on this.
    I a confuse.

    Thank you in advance.

  2. #2
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,889
    Mentioned
    74 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by jemz View Post
    Is this possible,i have 2 divs,in leftside and in right side,in my leftside Div i have 3 links as my menu and i want that if i want to click on each link it will load to my second Div which is in Right side Div.i hope someone help me on this.
    I a confuse.

    Thank you in advance.
    Please show the code that you have already tried.

    >>> i want to click on each link it will load to my second Div which is in Right side Div.

    What is "it" that you want to load into the right-hand div?
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Wolfshade on earning Member of the Month for August 2014

  3. #3
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,157
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John_Betong View Post
    Please show the code that you have already tried.

    >>> i want to click on each link it will load to my second Div which is in Right side Div.

    What is "it" that you want to load into the right-hand div?
    Code:
    <div id="menu">	
    		<ul>
    		    <li class="header">My Menu</li>
    		  <li><a href="page1.php"><span>search by name <span></a></li>
    		 <li><a href="page2.php"><span>search by fname<span></a></li>
    		  <li><a href="page3.php"><span>search by age<span></a></li>
    									
    		</ul>
     </div>	
    
    
    
    This second div is on the right side of it.
    when i click the link i want that it will load to the right side of my div.I am still beginner on this php and i have no idea on how to do this.I hope you can share and help me.Thank you in advance.
    
    
    <div id="content">
     load content here.
    </div>
    How do i load the pa

  4. #4
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,157
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John_Betong View Post
    Please show the code that you have already tried.

    >>> i want to click on each link it will load to my second Div which is in Right side Div.

    What is "it" that you want to load into the right-hand div?
    Code:
    <div id="menu">	
    		<ul>
    		    <li class="header">My Menu</li>
    		  <li><a href="page1.php"><span>search by name <span></a></li>
    		 <li><a href="page2.php"><span>search by fname<span></a></li>
    		  <li><a href="page3.php"><span>search by age<span></a></li>
    									
    		</ul>
     </div>	
    
    
    
    This second div is on the right side of it.
    when i click the link i want that it will load to the right side of my div.I am still beginner on this php and i have no idea on how to do this.I hope you can share and help me.Thank you in advance.
    
    
    <div id="content">
     load content here.
    </div>
    How do i load the pa

  5. #5
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,889
    Mentioned
    74 Post(s)
    Tagged
    6 Thread(s)
    Try this:

    PHP Code:
    // _menu.php _prefix to show include and only part of a page
    $a=array
    {
      
    'index.php?page=name'   => 'search by name',
      
    'index.php?page=fname'  => 'search by fname',
      
    'index.php?page=age'    => 'search by age',
    }
    echo 
    "<ul>";
      foreach(
    $a as $url => $item)
      {
        echo 
    '<li>';
          echo 
    "<a href='" .$url ."'><span>" .$item .'<span></a>';
        echo 
    '</li>';
      }
    echo 
    '</ul>'

    and your main page:
    PHP Code:

    // index.php
    <html>
      <...header/title/css/etc...>
    <body>
    <div id='outer'>

      <div id='menu'>
        <?php include '_menu.php';?>
      </div>

      <div id='content'
        <?php 
          $inc_page 
    = isset($_GET['page']) ? $_GET['page'] : 'blurb';
          if( ! 
    file_exists$inc_page ) )
          {
            
    $inc_page 'blurb';
          }
          include 
    '_' .$inc_page .'.php';
        
    ?>
      </div>

      <div id='footer'>
        <?php include '_footer.php';?>
      </div>

    </div?<?php /* outer */ ?>
    <body>
    </html>
    Last edited by John_Betong; Sep 7, 2012 at 07:33. Reason: spelling: not my fortay
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Wolfshade on earning Member of the Month for August 2014

  6. #6
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,157
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John_Betong View Post
    Try this:

    PHP Code:
    // _menu.php _prefix to show include and only part of a page
    $a=array
    {
      
    'index.php?page=name'   => 'search by name',
      
    'index.php?page=fname'  => 'search by fname',
      
    'index.php?page=age'    => 'search by age',
    }
    echo 
    "<ul>";
      foreach(
    $a as $url => $item)
      {
        echo 
    '<li>';
          echo 
    "<a href='" .$url ."'><span>" .$item .'<span></a>';
        echo 
    '</li>';
      }
    echo 
    '</ul>'

    and your main page:
    PHP Code:

    // index.php
    <html>
      <...header/title/css/etc...>
    <body>
    <div id='outer'>

      <div id='menu'>
        <?php include '_menu.php';?>
      </div>

      <div id='content'
        <?php 
          $inc_page 
    = isset($_GET['page']) ? $_GET['page'] : 'blurb';
          if( ! 
    file_exists$inc_page ) )
          {
            
    $inc_page 'blurb';
          }
          include 
    '_' .$inc_page .'.php';
        
    ?>
      </div>

      <div id='footer'>
        <?php include '_footer.php';?>
      </div>

    </div?<?php /* outer */ ?>
    <body>
    </html>

    Hi, Thank you for the reply,can i ask what does blurb means is that a page?

  7. #7
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,889
    Mentioned
    74 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by jemz View Post
    Hi, Thank you for the reply,can i ask what does blurb means is that a page?
    Sllghtly modifed so it should now work


    PHP Code:

        $inc_page 
    = isset($_GET['page']) ? $_GET['page'] : 'blurb';
        
    $inc_page '_'  $inc_page '.php';
        if( ! 
    file_exists$inc_page ) )
        {
            
    $inc_page '_blurb.php'// default $inc_page 
        
    }
        include 
    $inc_page;
        
    ?> 
    The $inc_page gets the $_GET['page'] variable.

    Example:
    index.php?page=name OR index.php?page=fname OR index.php?page=age

    The $inc_page is tested to see if it exists. If it does then the $inc_page is included ELSE '_blurb.php' is included.

    Wiki:
    A blurb is a short summary accompanying a creative work; the word was coined in 1907 by American humorist Gelett Burgess. It may refer to the text on the back of a book but can also be seen on DVD and video cases, web portals and news websites. A blurb may introduce a newspaper or magazine feature story.
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Wolfshade on earning Member of the Month for August 2014

  8. #8
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,157
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John_Betong View Post
    Sllghtly modifed so it should now work


    PHP Code:

        $inc_page 
    = isset($_GET['page']) ? $_GET['page'] : 'blurb';
        
    $inc_page '_'  $inc_page '.php';
        if( ! 
    file_exists$inc_page ) )
        {
            
    $inc_page '_blurb.php'// default $inc_page 
        
    }
        include 
    $inc_page;
        
    ?> 
    The $inc_page gets the $_GET['page'] variable.

    Example:
    index.php?page=name OR index.php?page=fname OR index.php?page=age

    The $inc_page is tested to see if it exists. If it does then the $inc_page is included ELSE '_blurb.php' is included.

    Thank you so much i will give a try on this.


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
  •