Include statement

R

RA

I am trying to use the 'include' statement to include code from another
file. The syntax that my book gives for it : <!--#include
file="file.htm"--> does not produce any results. The code looks like a
comment anyway, so I don't understand how that's supposed to work. I have
the same menu on every page and just want to code it once and then include
it in each page so I don't have to go through and change every page when I
change something in the menu. Anyone else have any luck with it? Thanks!
 
S

Steve Pugh

RA said:
I am trying to use the 'include' statement to include code from another
file. The syntax that my book gives for it : <!--#include
file="file.htm"--> does not produce any results. The code looks like a
comment anyway, so I don't understand how that's supposed to work. I have
the same menu on every page and just want to code it once and then include
it in each page so I don't have to go through and change every page when I
change something in the menu. Anyone else have any luck with it? Thanks!

Have you checked that your server supports includes?

Steve
 
D

David Dorward

RA said:
I am trying to use the 'include' statement to include code from another
file. The syntax that my book gives for it : <!--#include
file="file.htm"--> does not produce any results. The code looks like a
comment anyway, so I don't understand how that's supposed to work.

It is an SSI directive.
Your webserver software must be configured to look for SSI directives on the
page. It will then include the file and send the combined file to the
client.
 
L

Lorne Cameron

I have also been looking into SSI for pretty much the same reason. So
I've been trying out a few things and it works great once uploaded to my
server. But when I try to view the local copy of the page the "include"
parts aren't displayed. I'm assuming this is normal behaviour due to
the nature of SSI, but is there any way around this so that I can see
what my pages will really look like before uploading them?

Thanks.
LC.
 
I

Isofarro

Lorne said:
But when I try to view the local copy of the page the "include"
parts aren't displayed. I'm assuming this is normal behaviour due to
the nature of SSI, but is there any way around this so that I can see
what my pages will really look like before uploading them?

Install a webserver locally.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top