How to emebed a html file in another html file
-
Hi, I have a website that's running from several months. Most of the web pages contain a common marquee tag. I want to put the tag in a html file and embed the html file wherever needed so that when ever a change is made to the marquee tag it affects all the web pages. Thanks in advance
-
Hi, I have a website that's running from several months. Most of the web pages contain a common marquee tag. I want to put the tag in a html file and embed the html file wherever needed so that when ever a change is made to the marquee tag it affects all the web pages. Thanks in advance
The easiest way is probably with Server Side Includes[^] You put a tag like this in your main html page
which points to the other html file that contains the html you want to insert. The server (either IIS or Apache) will insert this file when the page is served. This is something that I believe is turned on by default on IIS and Apache, but you may have to rename your main html to myfile.shtml to indicate that you want to process SSIs in the file. (This means that you may also have the change the default pages for your directories if you rely on default pages being default.html or something like that). Some of this may vary between providers though, so if in doubt check with your web host.
Simon
-
Hi, I have a website that's running from several months. Most of the web pages contain a common marquee tag. I want to put the tag in a html file and embed the html file wherever needed so that when ever a change is made to the marquee tag it affects all the web pages. Thanks in advance
-
The easiest way is probably with Server Side Includes[^] You put a tag like this in your main html page
which points to the other html file that contains the html you want to insert. The server (either IIS or Apache) will insert this file when the page is served. This is something that I believe is turned on by default on IIS and Apache, but you may have to rename your main html to myfile.shtml to indicate that you want to process SSIs in the file. (This means that you may also have the change the default pages for your directories if you rely on default pages being default.html or something like that). Some of this may vary between providers though, so if in doubt check with your web host.
Simon
Didn't even know you could turn off server side includes. You definitely do not need to rename the file though. However aspx pages may not process server side includes. Not much point considering what they do.
If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) www.JacksonSoft.co.uk
-
Didn't even know you could turn off server side includes. You definitely do not need to rename the file though. However aspx pages may not process server side includes. Not much point considering what they do.
If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) www.JacksonSoft.co.uk
The Man from U.N.C.L.E. wrote:
Didn't even know you could turn off server side includes. You definitely do not need to rename the file though.
You can[^], and you can also configure them to only be executed for specific file extensions, so it does depend on what your web host has got setup. My web host only processes SSIs on files named .shtml and .shtm. By default I think it's just on for all files, but you can't rely on that when you didn't do the IIS install yourself.
The Man from U.N.C.L.E. wrote:
aspx pages may not process server side includes. Not much point considering what they do.
Yup, SSIs are not processed on aspx pages. You could probably hack up an alternative using something like
Response.Write()
, but like you say, not much point for asp. You'd probably just use something like master pages instead.Simon