hi,

is it possible for me to embed part of my site into another?

i want to give someone a piece of php code maybe a page of code which will embed my whole intranet site into theirs so it looks like they are still on the other persons site even though i am hosting the intranet?

is it php or jave script or what is best?

thanks again for your help,

You can use an iframe to embed another url in a page.

thanks i will give that a go. does the css from my site display the content in the iframe no problem? is iframes the best solution then?

thanks

An iframe is a webpage inside a webpage.

The web browser will interpret the content in the iframe like it would if you went to the actual page.

Member Avatar for diafol

There are a number of ways to do it.

You can capture the info via CURL, file_get_contents() - if your server allows it. The problem with iframe is that you need to set the size of the iframe - the containing page has no idea about the size of the content so cannot resize dynamically, so you may find that the 'embedded' content is cut off or has load of whitespace.

One benefit of iframe is that the 'embedded' data retains the layout/styling of the original page. Some other techniques won't do this, especially if css references are relative, e.g. 'css/main.css' as opposed to full url: 'http://www.example.com/css/main.css'. This may also apply to src attributes, eg images.

The benefit of some of the others is that you can trim the content to your requirements - preg and strpos functions are useful for this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.