|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have a footer in html format that is in all my pages, how can I do to include it in my pages without re-typing it?
Thanks in advance. |
|
#2
|
|||
|
|||
|
Are you using any kind of server-side programming like PHP?
|
|
#3
|
|||
|
|||
|
I wanted to do the same thing as I have several pages that have the same footer.
Instead of using ssi, (didn't want to change the extensions of all my pages) I used a java script to deliver the footer to these pages. Now if I have to make a change, I change it on the one doc and it affects all my pages. |
|
#4
|
|||
|
|||
|
sawz,
Would you be kind to tell us how it can be done in JavaScript? I need to display graphics and tables as a common left-hand side menu pannel. <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by sawz: I wanted to do the same thing as I have several pages that have the same footer. Instead of using ssi, (didn't want to change the extensions of all my pages) I used a java script to deliver the footer to these pages. Now if I have to make a change, I change it on the one doc and it affects all my pages. [/quote] |
|
#5
|
|||
|
|||
|
If you goto the post called "include file" it should help with what you are trying to do.
Or just click http://www.devshed.com/Talk/Forums/...TML/000162.html to go straight to the post. |
|
#6
|
||||
|
||||
|
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by Fahad:
sawz, Would you be kind to tell us how it can be done in JavaScript? I need to display graphics and tables as a common left-hand side menu pannel. [/quote] If you use JS to do it you will run in to massive problems when people who turn JS off visit your site. Take a look at http://www.dorward.co.uk/dolt.html I know its a shameless bit of self promotion. But the best way is SSI: http://www.bignosebird.com/ssi.shtml |
|
#7
|
|||
|
|||
|
Most internet sites these days rely heavily on Javascript!! I think most users would rather enable their javascript (a 1 time 1 mintute step) than unecessarily wait for the server to come back as with SSIs.
So I would recommend use of Javascript whenever and wherever possible. To do this in Javascript, use this wherever you want to include your footer: document.write('<SCRIPT LANGUAGE="JavaScript" SRC="x.js"></SCRIPT>'); where x.js is another javasctipt that just writes the HTML for the footer, eg document.write(<footer_html> ); Hope that was helpful. Irene PS this may not work as is if you are using layers!! |
|
#8
|
|||
|
|||
|
If you want to use SSI, in particular PHP, you can use this little bit of code to include the footer in all of your pages:
<?php include(footer.html); ?> Then all you have to do is make the stuff in the footer file the footer, and voila! Only problem is you have to have PHP enabled on the server for this to work. Michael |
|
#9
|
|||
|
|||
|
Just responding to rinadib's comment. It is better to use SSI, and there is no slowdown time waiting for the server since it parses it right when requested and then sends it. Unless the server is down, it'll be just as fast and probably a little fast since it wouldn't have to wait for javascript.
![]() ------------------ -Colin Anderson http://www.htmletc.net/ "There are two ways to write error-free programs. Only the third one works." |
|
#10
|
|||
|
|||
|
Sorry for the second reply
, but FieroEtnl, the code should be:<?php include("footer.html"); ?> |
|
#11
|
||||
|
||||
|
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by rinadib:
I think most users would rather enable their javascript (a 1 time 1 mintute step) than unecessarily wait for the server to come back as with SSIs. So I would recommend use of Javascript whenever and wherever possible.[/quote] Users may not realise that the reason the site does not work is that JavaScript is off They may not use a webbrowser that has JavaScript available to it. They may use a speech basd web browser (e.g. becuase they are blind) which does not support JavaScript. They might decide that reather than suffer popup adverts they would just not visit your site at all. I would [B]never[/B} make JavaScript a requirement for viewing a website (JavaScript enhancements are fine but everything should degrade smoothly). |
|
#12
|
|||
|
|||
|
Or just use frames...
Set the page into frames using the bottom one as the footer and display the rest wherever. |
|
#13
|
|||
|
|||
|
No offence, but frames are so old and lame. This can be done easily with js or an SSI. Tables load faster than frames and don't cause "layout" problems.
Try some of the js stuff if you can't do SSI(Server Side Includes). Steve ------------------ Web Application Developer URL |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > How to include a html code in all my pages? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|