kspuea
asked on
To show another HTML file in a HTML file
Hi,
I have this small HTML file, and I need to show it out in another HTML file.
Someone has told me that I can use <!-- include file="..."-->, but this line just like a comment to HTML. I have tried it, it has no effects at all.
I have also tried <IFrame name="stock" src="http://.../stockquotes.html" frameborder="no" border=0>, but it covers all my graphics files which in the same table. And it doesn't work in Netscape also.
Does anyone know how to solve this problem?
Thanks a lot in advance.
I have this small HTML file, and I need to show it out in another HTML file.
Someone has told me that I can use <!-- include file="..."-->, but this line just like a comment to HTML. I have tried it, it has no effects at all.
I have also tried <IFrame name="stock" src="http://.../stockquotes.html" frameborder="no" border=0>, but it covers all my graphics files which in the same table. And it doesn't work in Netscape also.
Does anyone know how to solve this problem?
Thanks a lot in advance.
Indeed it all has to be done server-side. But not necessarily with the #include file.
You can also write your own javascript / vbscript-function which takes a file as a parameter and then read the file, and place it in your other html file.
Javascript:
<script language=javascript runat=server>
<!--
var fso, f;
fso = new ActiveXObject("Scripting.F ileSystemO bject");
f = fso.OpenTextFile("c:\\your file.html" , 1);
document.write(f.ReadAll() );
//-->
</script>
VBScript:
<script language=vbscript runat=server>
<!--
function WriteOutText
Dim fso, f
Set fso = CreateObject("Scripting.Fi leSystemOb ject")
Set f = fso.OpenTextFile("c:\yourf ile.html", 1)
WriteOutText = f.ReadAll
end function
//-->
</script>
You can also write your own javascript / vbscript-function which takes a file as a parameter and then read the file, and place it in your other html file.
Javascript:
<script language=javascript runat=server>
<!--
var fso, f;
fso = new ActiveXObject("Scripting.F
f = fso.OpenTextFile("c:\\your
document.write(f.ReadAll()
//-->
</script>
VBScript:
<script language=vbscript runat=server>
<!--
function WriteOutText
Dim fso, f
Set fso = CreateObject("Scripting.Fi
Set f = fso.OpenTextFile("c:\yourf
WriteOutText = f.ReadAll
end function
//-->
</script>
Hi,
External Source Files
take a look at this page
http://www.dansteinman.com/dynduo/en/source.html
look by technique 2
this is a script wich makes it possible to read in an external file and put it into a DIV tag.
yours,
ruben
External Source Files
take a look at this page
http://www.dansteinman.com/dynduo/en/source.html
look by technique 2
this is a script wich makes it possible to read in an external file and put it into a DIV tag.
yours,
ruben
ASKER
Hi gr8gonzo, thanks for your help. I have tried your method but unfortunately my server is a Lotus Domino server,not Apache server. So the method doesn't work. Furthermore, my HTML coding is all in Lotus Notes Forms. So I can't do like you said "rename the html file to shtml".
CJ_S, I have tried your method too. Unfortunately, I have this error message - "Automation server can't create object". Thus your method also doesn't work for me.
rtieland, I have taken a look at your reference. I will try it out after I digest the codes.
Sorry, pls bear with me. I'm new in HTML & Javascripts.
Thanks very much for all your help.
CJ_S, I have tried your method too. Unfortunately, I have this error message - "Automation server can't create object". Thus your method also doesn't work for me.
rtieland, I have taken a look at your reference. I will try it out after I digest the codes.
Sorry, pls bear with me. I'm new in HTML & Javascripts.
Thanks very much for all your help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Meaning that you don't have read / write permission at the server.
The person who told you that was KIND OF right. He was referring to Server-Side-Includes (SSI), which is enabled on many Apache servers. The command is actually
<!--#include virtual="filename.shtml"--
NO SPACES except between include and virtual! Make sure it's exactly as shown above. I've gone days of troubleshooting to realize I had forgotten the pound (#) sign in the include command. You can find more on SSI at BigNoseBird's site:
http://bignosebird.com under Server Side Includes. This is a great command for managing websites once you're used to the commands.
Rename both files' extensions from HTML to SHTML, and it should work. What host are you with?