Unstoppable Domains

Server Side Includes

Spaceship Spaceship
Watch

ecampsite.co.uk

Established Member
Impact
1
Hi there.
I currently have a problem regarding server side includes.
My site is purely html, and at the top of these html pages there is a large chunk of code that is the same on every page. If i change something in that code it means having to change every single html page which is very tedious. I heard about SSI and wondered whether i could put some text (the code that is the same on all the pages) in a file, and just change that file if i change it. Then all of the pages will have changed after making just the one change!!
If anyone could point me in the right direction for this and tell me if this is the right thing, i would be extremely grateful!!!
Thank you
Craig
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
.US domains.US domains
easy!

make a text file and call it, for example, header.txt.
put the repititious code into that file.
now in the html files, resave them as whatever.php rather than whatever.html.
then, go to the part with the code thats the same and take it out of whatever.php.
in that place, put the following code:

PHP:
<?php
include('header.txt');
?>

and you're done! now you only edit that one text file to change all of them.

how this works is that the script calls whatever is in the file into the source of the page, so this can be done with a .html file extension (instead of .txt) and a lot more!

hope that helped :)

If this helped, rep plz ;)
 
0
•••
thank you so much for the quick reply!
you know the included file, what difference would it make if it was the extension, .php, .html, or .txt would the include script still work the same and just include what is in the header file?
 
0
•••
You can use most any file extension for the file that's going to be included. But if you have any sensitive data in the file that you don't want users to see, then you'll want to use .php for the extension and surround the data with php start and end tags.
 
0
•••
deadserious has is right ;)

You can use any file type because it simply takes the source code. But, if you're using sensitive data (such as passwords to a database or something), then you should use php and put it inside the php tags (<?php ?>). this means that all the stuff will be processed on the server and the client can never see it.

unless theyre an uber 1337 |-|4><><0R!!!
 
0
•••
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back