| | |
Leave sidebar and title bar but change main content
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Feb 2008
Posts: 628
Reputation:
Solved Threads: 46
Currently, my index.html is like this
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
HTML and CSS Syntax (Toggle Plain Text)
<html> <head> <title>EngineeringNotes.net</title> <link href="style.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <div class="header"> <div id="logo"> <h1>EngineeringNotes.net</h1> </div> <div class="menu"> <ul> <li><a href="mailto:daviddoria@gmail.com">Contact Me</a></li> <li><a href="phpBB3">Forums</a></li> <li><a href="Ideology.html">Ideology</a></li> </ul> </div><!-- end menu --> </div><!-- end header --> <div class="page"><!-- start page --> <div class="sidebar"><!-- start sidebar --> <h2>EE Topics</h2> <ul> <li><a href="Notes/EE/PatternRecognition.pdf">Pattern Recognition</a> </li> <li><a href="Notes/EE/ImageProcessing.pdf">Image Processing</a> </li> <li><a href="Notes/EE/ComputerVision.pdf">Computer Vision</a> </li> <li><a href="Notes/EE/ComputerGraphics.pdf">Computer Graphics (stub)</a> </li> <li><a href="Notes/EE/SignalsAndSystems.pdf">Signals and Systems</a> </li> <li><a href="Notes/EE/Communications.pdf">Communications</a> </li> </ul> </div><!-- end sidebar --> <div class="content"><!-- start content --> <h2>About this Site</h2> <p> This site is inteded to provide a "crash course" in many subject areas related to electrical engineering. The primers are not at all designed to be a replacement for a formal course in these topics. The target audience is a serious student who feels that it is worth their time outside of class to make sure they are getting the "big picture" and seeing the value of the subject rather than simply learning the mechanics of "doing problems". </div><!-- end content --> </div><!-- end page --> </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
•
•
Join Date: Dec 2008
Posts: 63
Reputation:
Solved Threads: 13
Use Server-Side Includes, e.g.:
HTML and CSS Syntax (Toggle Plain Text)
<!--#include file="page.html" -->
Or:
HTML and CSS Syntax (Toggle Plain Text)
<!--#include file="header.html" --> <body> <h1>Title</h1> <p>...</p> </body> <!--#include file="footer.html" -->
Chris F.A. Johnson
http://cfajohnson.com
http://cfajohnson.com
So should the code look something like this?
With the header.html file as...
...and the sidebar.html file being...
HTML and CSS Syntax (Toggle Plain Text)
<html> <head> <title>EngineeringNotes.net</title> <link href="style.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <!--#include file="header.html" --> <div class="page"><!-- start page --> <!--#include file="sidebar.html" --> <div class="content"><!-- start content --> <h2>About this Site</h2> <p> This site is inteded to provide a "crash course" in many subject areas related to electrical engineering. The primers are not at all designed to be a replacement for a formal course in these topics. The target audience is a serious student who feels that it is worth their time outside of class to make sure they are getting the "big picture" and seeing the value of the subject rather than simply learning the mechanics of "doing problems". </div><!-- end content --> </div><!-- end page --> </body></html>
With the header.html file as...
HTML and CSS Syntax (Toggle Plain Text)
<div class="header"> <div id="logo"> <h1>EngineeringNotes.net</h1> </div> <div class="menu"> <ul> <li><a href="mailto:daviddoria@gmail.com">Contact Me</a></li> <li><a href="phpBB3">Forums</a></li> <li><a href="Ideology.html">Ideology</a></li> </ul> </div><!-- end menu --> </div><!-- end header -->
...and the sidebar.html file being...
HTML and CSS Syntax (Toggle Plain Text)
<div class="sidebar"><!-- start sidebar --> <h2>EE Topics</h2> <ul> <li><a href="Notes/EE/PatternRecognition.pdf">Pattern Recognition</a> </li> <li><a href="Notes/EE/ImageProcessing.pdf">Image Processing</a> </li> <li><a href="Notes/EE/ComputerVision.pdf">Computer Vision</a> </li> <li><a href="Notes/EE/ComputerGraphics.pdf">Computer Graphics (stub)</a> </li> <li><a href="Notes/EE/SignalsAndSystems.pdf">Signals and Systems</a> </li> <li><a href="Notes/EE/Communications.pdf">Communications</a> </li> </ul> </div><!-- end sidebar -->
![]() |
Other Threads in the HTML and CSS Forum
- Previous Thread: Refer to button text via CSS
- Next Thread: Changing image BG onclick
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7





