Forum Moderators: open

Message Too Old, No Replies

Question about printing external files to webpage

         

sinthetiq

10:48 pm on Oct 12, 2005 (gmt 0)

10+ Year Member



Hello, not sure if this is the right forum to post, but i had a question regarding a site i'm building.

first, the site i am building is going to be a single layout, with numerous pages.

the header/footer will be the same throughout the site, so i would like to have the ability to edit the header/footer without having to go through each and every page and manually changing what i have to change.

is there a way to be able to alter the header/footer without having to do this? can i do this through css or some other means. how could i go about this?

thank you!

garann

11:02 pm on Oct 12, 2005 (gmt 0)

10+ Year Member



You can use Server Side Includes to add external snippets of code to your HTML. Not all hosts support them, but for the ones that do, the code looks like this:

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

(allows relative paths)

or

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

sinthetiq

11:12 pm on Oct 12, 2005 (gmt 0)

10+ Year Member



thanks. i wasnt able to use that code, but i was able to use

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

however, i cant use that.

is there a way i can make a fixed layout, then use that layout for each page, while still being able to edit the layout, without going on each and every page?

Dijkgraaf

12:10 am on Oct 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There are various ways and means, some of them depend on what type of web server you are using (e.g. Linux, IIS), There are also applications called Content Management Systems (or CMS for short), but these are probably more than you need for just the common header/footers.
So let us know what type of server you are using and if you have access to any scripting languages.

islandlizard

3:04 am on Oct 13, 2005 (gmt 0)

10+ Year Member



Presuming you have PHP or a similar scripting language, you could do th is the other way round, i.e. create the framework page and include the content, instead of creating seperate pages and including the standard bits,.

Create your core page framework as index.php without any content.

Then, by using URLS such as:

www.mydomain.com/index.php/section1/
www.mydomain.com/index.php/section2/

use your scripting language to parse out whatever falls after index.php (i.e.: section1) and have a single 'include' statement to pull that file into the page content area.

That way, the index.php page is the only page used throughout the site so changes to that show throughout.

It's late, I;m new here, and very tired, so I might not have explained that too well. Will return in morning to see if that sounds like a solution and expand on it if it is!

sinthetiq

6:28 am on Oct 13, 2005 (gmt 0)

10+ Year Member



Hello,

Thanks for the help. I ended up just using the php/include for the separate areas that i wish to maintain on each page. i made the basic template, then cut it up and made separate files for each of the includes.

Thanks again for all the help!

borninblood

10:25 am on Oct 17, 2005 (gmt 0)



Why not use JavaScript?

Here is the best of code you put on the site.

<script language="JavaScript" src="footer.js"></script>

Here is the file you save as footer.js.

document.write('<a href="legal.htm">Read Me</a></br>');
document.write('Whatever footer crap you want');

Robin_reala

11:35 am on Oct 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Because a lot of users have Javascript turned off, and search engines won't index content written out using JS.