Leave sidebar and title bar but change main content

Thread Solved

Join Date: Feb 2008
Posts: 628
Reputation: daviddoria is a jewel in the rough daviddoria is a jewel in the rough daviddoria is a jewel in the rough 
Solved Threads: 46
daviddoria daviddoria is offline Offline
Practically a Master Poster

Leave sidebar and title bar but change main content

 
0
  #1
Mar 22nd, 2009
Currently, my index.html is like this
HTML and CSS Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <title>EngineeringNotes.net</title>
  4. <link href="style.css" rel="stylesheet" type="text/css" media="screen" />
  5. </head>
  6. <body>
  7.  
  8.  
  9. <div class="header">
  10. <div id="logo">
  11. <h1>EngineeringNotes.net</h1>
  12. </div>
  13. <div class="menu">
  14. <ul>
  15. <li><a href="mailto:daviddoria@gmail.com">Contact Me</a></li>
  16. <li><a href="phpBB3">Forums</a></li>
  17. <li><a href="Ideology.html">Ideology</a></li>
  18. </ul>
  19. </div><!-- end menu -->
  20. </div><!-- end header -->
  21.  
  22.  
  23. <div class="page"><!-- start page -->
  24. <div class="sidebar"><!-- start sidebar -->
  25. <h2>EE Topics</h2>
  26. <ul>
  27. <li><a href="Notes/EE/PatternRecognition.pdf">Pattern Recognition</a> </li>
  28. <li><a href="Notes/EE/ImageProcessing.pdf">Image Processing</a> </li>
  29. <li><a href="Notes/EE/ComputerVision.pdf">Computer Vision</a> </li>
  30. <li><a href="Notes/EE/ComputerGraphics.pdf">Computer Graphics (stub)</a> </li>
  31. <li><a href="Notes/EE/SignalsAndSystems.pdf">Signals and Systems</a> </li>
  32. <li><a href="Notes/EE/Communications.pdf">Communications</a> </li>
  33. </ul>
  34.  
  35.  
  36. </div><!-- end sidebar -->
  37.  
  38. <div class="content"><!-- start content -->
  39. <h2>About this Site</h2>
  40. <p>
  41. This site is inteded to provide a "crash course" in many subject areas
  42. related to electrical engineering. The primers are not at all designed
  43. to
  44. be a replacement for a formal course in these topics. The target
  45. audience is a serious student who feels that it is worth their time
  46. outside of class to make sure they are getting the "big picture" and
  47. seeing the value of the subject rather than simply learning the mechanics of "doing problems".
  48.  
  49.  
  50. </div><!-- end content -->
  51.  
  52. </div><!-- end page -->
  53.  
  54. </body></html>

If I want to change the content in the "page" section, but leave the title header and sidebar there, how would I do this? I can't imagine I have to have the header and sidebar on every page, or when I have to make a change to either of those, I have to change it on every page!

Any suggestions?

Thanks,
Dave
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 63
Reputation: cfajohnson is an unknown quantity at this point 
Solved Threads: 13
cfajohnson cfajohnson is offline Offline
Junior Poster in Training

Re: Leave sidebar and title bar but change main content

 
0
  #2
Mar 23rd, 2009

Use Server-Side Includes, e.g.:

HTML and CSS Syntax (Toggle Plain Text)
  1. <!--#include file="page.html" -->

Or:

HTML and CSS Syntax (Toggle Plain Text)
  1. <!--#include file="header.html" -->
  2. <body>
  3. <h1>Title</h1>
  4. <p>...</p>
  5. </body>
  6. <!--#include file="footer.html" -->
Chris F.A. Johnson
http://cfajohnson.com
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 77
Reputation: mj080 is an unknown quantity at this point 
Solved Threads: 5
mj080's Avatar
mj080 mj080 is offline Offline
Junior Poster in Training

Re: Leave sidebar and title bar but change main content

 
0
  #3
Mar 24th, 2009
i would suggest to iFrames
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 434
Reputation: FC Jamison is on a distinguished road 
Solved Threads: 20
Team Colleague
FC Jamison's Avatar
FC Jamison FC Jamison is offline Offline
Posting Pro in Training

Re: Leave sidebar and title bar but change main content

 
0
  #4
Mar 25th, 2009
So should the code look something like this?

HTML and CSS Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <title>EngineeringNotes.net</title>
  4. <link href="style.css" rel="stylesheet" type="text/css" media="screen" />
  5. </head>
  6. <body>
  7.  
  8.  
  9. <!--#include file="header.html" -->
  10.  
  11. <div class="page"><!-- start page -->
  12.  
  13. <!--#include file="sidebar.html" -->
  14.  
  15.  
  16. <div class="content"><!-- start content -->
  17. <h2>About this Site</h2>
  18. <p>
  19. This site is inteded to provide a "crash course" in many subject areas
  20. related to electrical engineering. The primers are not at all designed
  21. to
  22. be a replacement for a formal course in these topics. The target
  23. audience is a serious student who feels that it is worth their time
  24. outside of class to make sure they are getting the "big picture" and
  25. seeing the value of the subject rather than simply learning the mechanics of "doing problems".
  26.  
  27.  
  28. </div><!-- end content -->
  29.  
  30. </div><!-- end page -->
  31.  
  32. </body></html>

With the header.html file as...
HTML and CSS Syntax (Toggle Plain Text)
  1. <div class="header">
  2. <div id="logo">
  3. <h1>EngineeringNotes.net</h1>
  4. </div>
  5. <div class="menu">
  6. <ul>
  7. <li><a href="mailto:daviddoria@gmail.com">Contact Me</a></li>
  8. <li><a href="phpBB3">Forums</a></li>
  9. <li><a href="Ideology.html">Ideology</a></li>
  10. </ul>
  11. </div><!-- end menu -->
  12. </div><!-- end header -->

...and the sidebar.html file being...

HTML and CSS Syntax (Toggle Plain Text)
  1. <div class="sidebar"><!-- start sidebar -->
  2. <h2>EE Topics</h2>
  3. <ul>
  4. <li><a href="Notes/EE/PatternRecognition.pdf">Pattern Recognition</a> </li>
  5. <li><a href="Notes/EE/ImageProcessing.pdf">Image Processing</a> </li>
  6. <li><a href="Notes/EE/ComputerVision.pdf">Computer Vision</a> </li>
  7. <li><a href="Notes/EE/ComputerGraphics.pdf">Computer Graphics (stub)</a> </li>
  8. <li><a href="Notes/EE/SignalsAndSystems.pdf">Signals and Systems</a> </li>
  9. <li><a href="Notes/EE/Communications.pdf">Communications</a> </li>
  10. </ul>
  11.  
  12.  
  13. </div><!-- end sidebar -->
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 434
Reputation: FC Jamison is on a distinguished road 
Solved Threads: 20
Team Colleague
FC Jamison's Avatar
FC Jamison FC Jamison is offline Offline
Posting Pro in Training

Re: Leave sidebar and title bar but change main content

 
0
  #5
Mar 25th, 2009
OK...that worked on my server when I named the original document index.shtml. The shtml extention was required so that I could add the SSI (server side include) directives to the existing page.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 628
Reputation: daviddoria is a jewel in the rough daviddoria is a jewel in the rough daviddoria is a jewel in the rough 
Solved Threads: 46
daviddoria daviddoria is offline Offline
Practically a Master Poster

Re: Leave sidebar and title bar but change main content

 
0
  #6
Mar 25th, 2009
Interesting, cool though - thanks all!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the HTML and CSS Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC