Want same header on muliple pages - how to?

HTML Source, Tables, CSS, JavaScript, and Embed/Object.

Moderators: BobCP, agsone, Neil Parks, gregtutor, Lem3

Want same header on muliple pages - how to?

Postby skreynol on Mon Nov 14, 2011 1:57 pm

I want the same header on multiple pages. If I use a 'template' approach the code is separately embedded in each page and if I change my logo, color scheme, etc I have to go into each page separately. Right now I have made a separate page with the header stuff and incorporated it into the other pages as an iframe. Is there a better way? Does HTML support a COPY function that will retrieve code on the fly like some other languages?
skreynol
 
Posts: 11
Joined: Thu Mar 10, 2011 4:20 pm
Country: United States (us)

Re: Want same header on muliple pages - how to?

Postby wink0r on Mon Nov 14, 2011 3:45 pm

Most of the things listed are layout/styling that can be done in an external css stylesheet. A change to the single external stylesheet is effected on all pages linked to that stylesheet. If you are using an image logo it can be set as a background image that is called by the stylesheet, so it would also change for all pages.

To see external stylesheets in action visit the KazGarden Demo: http://www.gimp-werkstatt.de/kaze/ There are no changes to the html file, only the css is changed from page to page.

For more information about designing with stylesheets see gregtutor's site: http://www.gregtutor.plus.com/webdesign/index.html

Alternatively, a php include would be better than an iframe. Search bots do not see the content of an iframe. For some basic information on php includes see agsone's page at: http://agsone.100webcustomers.com/phpinclude.php
Last edited by wink0r on Mon Nov 14, 2011 3:50 pm, edited 2 times in total.
wink0r
 
Posts: 2595
Joined: Tue Aug 28, 2007 10:10 pm
Location: East Coast - USA
Country: United States (us)

Re: Want same header on muliple pages - how to?

Postby skreynol on Mon Nov 14, 2011 4:10 pm

Thank you for the reply. I am using and understand external style sheets - I will look at the php includes.

On second look, the chain of complications pending an effort to simplify maintenance is passing beyond my Walter Mitty-ish imaginings. Not to deride any of the efforts that have gone into all this complexity, I don't want to install handcoder, or PCPlus, or a desktop server so I can see my pages assembled, or override Kompozer's default document types or have to re-direct my existing pages to php - the PHP acronymn that the recursive definition helps not a twit to clarify -. In my old-school programming days when we worked with compiled languages it was a simple matter to include one body of core code in another body of code and the compiler just put it all together. My solution for now is to extract the source that I want to repeat, put it, without the HTML headers or anything else except some comments, in a separate file and then cut-and-paste it into the code when needed. This has several advantages - no server-side concerns, no problem viewing locally, no redirection, no new editor to learn. Thanks again.
Last edited by skreynol on Mon Nov 14, 2011 6:13 pm, edited 2 times in total.
skreynol
 
Posts: 11
Joined: Thu Mar 10, 2011 4:20 pm
Country: United States (us)

Re: Want same header on muliple pages - how to?

Postby gregtutor on Mon Nov 14, 2011 10:22 pm

You're not alone in wanting to avoid PHP includes. (I do, but mainly because the free web space I often use doesn't have the necessary software installed on the server.)

My solution is to use a multi-file text editor and use its multi-file search/replace facility to make changes to the "common" code snippets that are to appear in all files.
Last edited by gregtutor on Sun Dec 04, 2011 9:07 am, edited 1 time in total.
Greg Chapman
http://www.gregtutor.co.uk
Helping new users of KompoZer - but using BlueGriffon
gregtutor
Moderator
 
Posts: 3784
Joined: Wed Jun 20, 2007 8:25 am
Location: The Norfolk Broads, UK
Country: England (en)


Return to Advanced Design Q & A


Who is online

Users browsing this forum: No registered users and 1 guest