School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,449 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,573 people online right now. Registration is fast and FREE... Join Now!




change header of site, can I change one place to change all pages?

 

change header of site, can I change one place to change all pages?

crazyjugglerdrummer

22 Jun, 2009 - 12:42 PM
Post #1

YOUR AD HERE
Group Icon

Joined: 7 Jan, 2009
Posts: 677



Thanked: 94 times
Dream Kudos: 425
My Contributions
I don't actually have a site up, but on most sites there's usually a header and a nav bar that's the same on all the pages. If I want to make a change to either one, is there a way to just make the change in one place and see it reflected on all the pages? The html code would have to get the header and nav code from one location, as opposed to you just pasting the code into all the pages. I suppose you could use a server side language to read the html from a file and write it into all the pages on the site, so you'd only have to change the file. You could use frames too.

I'm really hoping this is possible, because it would make it so much easier, instead of going to every page on the site and editing the html. Browser caching could also help page load time, since its the same thing repeated on all pages.

thanks guys! smile.gif

User is offlineProfile CardPM
+Quote Post


William_Wilson

RE: Change Header Of Site, Can I Change One Place To Change All Pages?

22 Jun, 2009 - 12:47 PM
Post #2

lost in compilation
Group Icon

Joined: 23 Dec, 2005
Posts: 4,631



Thanked: 88 times
Dream Kudos: 3275
Expert In: Java, C, Javascript

My Contributions
With pure html, you would probably have to use frames to accomplish this. You would be better off using a server side language such as PHP. This would allow you to create a file or function (whichever you prefer) to be imported or called wherever the header is required.
User is offlineProfile CardPM
+Quote Post

gregwhitworth

RE: Change Header Of Site, Can I Change One Place To Change All Pages?

22 Jun, 2009 - 03:15 PM
Post #3

(this).problem + "sucks";
Group Icon

Joined: 20 Jan, 2009
Posts: 1,131



Thanked: 82 times
Dream Kudos: 50
Expert In: HTML, CSS, Web Design

My Contributions
Use server side includes - doesn't need special language - most hosting servers support it.

http://en.wikipedia.org/wiki/Server_Side_Includes

EX:

CODE

<!--#include virtual="header.html"-->


--

Greg
User is offlineProfile CardPM
+Quote Post

Ryanmiller

RE: Change Header Of Site, Can I Change One Place To Change All Pages?

22 Jun, 2009 - 03:23 PM
Post #4

New D.I.C Head
*

Joined: 20 Jun, 2009
Posts: 16


My Contributions
Yes, most commonly with the use of PHP includes which all major hosting companies support.


Just make the file: header.php, footer.php, etc and in those files, make the actual headers and menu bars, etc.

And then on each page, insert this code

CODE
<?php include("header.php"); ?>

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 01:49AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month