Forum Moderators: mack

Message Too Old, No Replies

Server Side Include

Confused!

         

rj87uk

3:42 pm on Jul 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

This is the first website ive made, ive tried a few things so im posting here for help :)

I use dreamweaver and i can just press add script,
So i added a SSI, and put it on the web, but it didn’t work.

Im not sure if i would have to pay more money and get that on the server? Im very confused i went on the internet and looked for ideas but came up with nothing!

Any help would be a great help!

Rj

ogletree

3:59 pm on Jul 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The pages have to be named .shtml for it to work. I would not use SSI. If you want to do anything else in the future you have to swtich to somthing else. Use PHP. Just add

AddType application/x-httpd-php .htm .html

to your .htaccess file so you can keep using your .htm and .html files. This will make all .htm and .html files run through the PHP engine but if you put includes on each page it does not matter. I do it without any problems.

and use

<?php include("page.html");?>

as your includes. If you want to use any other php later you can.

bsterz

4:01 pm on Jul 4, 2004 (gmt 0)

10+ Year Member



It could be that your host requires that you name the file .shtml for the include to work.

So you would have a file called /somepage.shtml that includes some other file with an html (or whatever) excension.

This may not be the fix, but it's the simplest thing to try first.

Bill

MichaelBluejay

3:58 am on Jul 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just in case the previous replies were confusing.....

1. Create your main page, e.g. <test.html>.

2. To include <insertion.html> in your <test.html> file, use this code somewhere inside <test.html>: <!--#include virtual="insertion.html"-->

3. Edit your <.htaccess> file (or create one if it's not already there, at the same level as your index.html file), so that it contains this line: AddHandler server-parsed: .html
Note that there's a period at the beginning of the filename.

That ought to do it. If it doesn't work, let us know whether <test.html> in a browser shows nothing unusual, or whether it says "An error occurred while processing this directive."

D_Blackwell

5:23 pm on Jul 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I just added this to a group of page that I'm working with.
AddType application/x-httpd-php .html

What is the difference between that and this?

AddHandler server-parsed: .html

MichaelBluejay

3:14 am on Jul 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



One is the old way and one is the new way. I don't remember which is which, I think AddHandler is the old way, but it still works on new servers. I always use AddHandler because it works fine and it's easier to remember.

Voltec

5:01 am on Jul 11, 2004 (gmt 0)

10+ Year Member



Here is a question for those of you suggesting to have all the .htm and .html files run through the php processor... Wouldn't this add a significant load to a busy server if a large portion of the pages did not need to process php instructions? Now, for myself, it probably is moot since a vast majority of my pages absolutely require php (and I have always used the .php extension for them)... but your suggestion just broght the question to my mind.

Any thoughts on this?
Matt