SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2005
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to open a new page in the <div> tag?

    i have created a page with CSS and there are some hyperlinks on the left side. what i want to do is, when user click the hyperlink, the page will be displayed in the <div id="content">...</div>. how to do that?

    my code:

    Code:
    <body>
    <div id="container">
    	<div id="banner">
    		<h1>Banner</h1>
    
    	</div>
    	<div id="nav">
    		<p>Welcome, <?php echo $_SESSION['user']; ?> [<a href="../auth/logout_process.php">Sign Out</a>]</p>
    		<p>
    		<div id="list-menu">
    		<ul>
    		<li><a href="default_menu.html">Home</a></li>
    		<li><a href="about_us.html">About Us</a></li>
    		<li><a href="../faculty/form_faculty.php?op=add">Add New Faculty</a></li>
    		<li><a href="../faculty/view_faculty.list.php">Lists of Faculties</a></li>
    		<li><a href="../program/form_program.php?op=add">Add New Program</a></li>
    		<li><a href="../program/view_program.list2.php">Lists of Programs</a></li>
    		<li><a href="../student/form_student.php">Add New Student</a></li>
    		<li><a href="../attendance/form_attendance.php">Add New Attendance</a></li>
    		<li><a href="../attendance/view_all_bydate.php">View Attendance List</a></li>
    		</ul>
    		</div>
    		</p>
    
    	</div>
    	<div id="content">
    		
    	</div>
    	<div id="footer">
    		<p>
    		Master of Science in Information Technology
    		ITT 751 - Advanced Internet &amp; Web Programming
    		Copyright &copy; 2006
    		</p>
    	</div>
    </div>
    </body>

  2. #2
    Winemaster bronze trophy BonRouge's Avatar
    Join Date
    Oct 2004
    Location
    Sendai, Japan
    Posts
    2,417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could do that with PHP includes or AJAX.

  3. #3
    Caveat surfer Buddy Bradley's Avatar
    Join Date
    May 2003
    Location
    Cambridge, UK
    Posts
    2,366
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why don't you want to reload the page? Be wary of breaking the way the web works by doing things like this - you could confuse your users.

  4. #4
    SitePoint Zealot
    Join Date
    Jun 2005
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Buddy Bradley
    Why don't you want to reload the page? Be wary of breaking the way the web works by doing things like this - you could confuse your users.
    reaload the page??? previously, i used table and <iframe> tag to display any clicked hyperlink but then i switched to CSS layout and create some CSS rollover image. i have tried use <iframe> tag and it works, but seems like weird when i see there is a <iframe> tag.

  5. #5
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    When you click the link, you have a server side script detect which page you want, and put the appropriate content in.

    Or, just copy and paste the template into several html files, put the right content into each one and set up the links appropriately.

  6. #6
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am trying to do the same thing and it's driving me nuts.

    This would be SO simple in frames or tables.

    And I'm not keen on learning PHP or AJAX or other stuff I don't need...

  7. #7
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,269
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)

    page in page

    Quote Originally Posted by RafalA
    This would be SO simple in frames or tables.
    And I'm not keen on learning PHP or AJAX or other stuff I don't need...
    That's just it. If you don't want to use frames or object tags, the you need to use either server-side or client-side scripting. This can't be done with CSS.

  8. #8
    Caveat surfer Buddy Bradley's Avatar
    Join Date
    May 2003
    Location
    Cambridge, UK
    Posts
    2,366
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wackyflik
    reaload the page???
    You say that like I suggested you sacrifice your first-born child!

    What is so wrong with reloading the page when you click on a link? It's how the web is supposed to work - don't add needless complexity or features just for the sake of it. If it ain't broke, don't try to fix it.

  9. #9
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Indeed - loading a new page is not what the div tag is for anyway. If you use AJAX, you just end up frustrating people who suddenly find their back button doesn't work as expected. Just reload the page with new content put in by server side scripting, or just separate html pages.


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
  •