Jump to content

Server Side Includes


Recommended Posts

I have been able to successfully use the following:

<!--#include virtual="/assets/nav.htm" --> to include pages from within my site. I would like to include a page that is on a second site of mine. I thought it would be as easy as

<!--#include virtual="http://www.othersite.com/assets/links.htm" -->. The only problem is it doesn't work. Does anyone know how to do this?

again I want to include a file that is held on a second site.

Link to comment
Share on other sites

Depending on the server setup, you might be able to do it with a php include. (As TCH Bruce showed above)


Having said that, I wouldn't do it. It will slow down the page load.


If that other page doesn't change often, just copy it over to your server and do a regular include. If it changes every so often, then set up a script to read the file, write the contents to a local file, or a database table, and essentially cache the content on your local site. You could set up a cron to update the content as often as you need.


This may seem like a lot of extra work, but I really would discourage including an external file if you can.

Edited by surefire
Link to comment
Share on other sites

Keep in mind for the php include,

that if the second site is not yours and they have hotlink protection enabled

you will not see images.


for an Iframe you might try this


><iframe src="http://www.another-domain.com/folder/file.html" 
height="550" width="100%" name="Assets" 
marginwidth=0 marginheight=3
frameborder=0  >
If you can see this,<br />
your browser doesn't understand IFRAME.<br />
However, click  this 
<A HREF="http://www.another-domain.com/folder/file.html">link</A> 
to see the page for Assets.</iframe>
<br />

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...