Including external sites

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
TheRiddler

Including external sites

Post by TheRiddler »

I have the standard CMS site and have played a bit with creating pages and it works more or less as it should The only issue I have is when I try to include some external pages. So if I have the mainpage and clicks a button on the menu to open a page, I want the page that shows in the content-area to be the content of my exchange webmail for example. However, if I try to link, it doesn't show anything. It just shows the "next page" and "previous page" with nothing above it.

I've tried using but that's changed to a comment when I apply it. Then I've tried playing with {embed} and other things, but it never seems to work. I even looked at these forums, but nothing here seems to do what I'm looking for either, so now I'm asking if there is a solution to this or not.
westis

Re: Including external sites

Post by westis »

Although it seem like many people have had issues with the {embed} tag, it does indeed seem to work, at least now when I tried it on my local machine. What you need to do is this (if you're using 0.11.x):

1. Add the following tag in your template, somewhere between the tags:

{content block='headertags' wysiwyg='false'}

2. On the page where you want the other page embedded, use content as content type and add this tag in the content box (replacing the url with your url of course):

{embed url=http://www.domain.org}

3. In the other content block, that is below the first one (and is called headertags), add this:

{embed header=true}  This is required to load the iframe javascript!


That should have the URL you specify to appear in the content area of that page.

However! The height will not be automatically set if using an external URL, that is a page that is not on the same domain as your CMSMS page.

I don't know any Javascript, so I have no idea about how the height of the iframe automatically can be set to the height of the embedded page, when the embedded page is not on the same domain. But you can change it to a fixed height, by doing a slight change in the file plugins/function.embed.php.

1. Around line 111, find this:

return  "";

2. Add height: 400px; (or whatever height you want), so that it will look like this:

return  "";


Hope that helps!
westis

Re: Including external sites

Post by westis »

Googling a bit about the height issue when iframing a page from an external domain, I have found this:

Due to security reasons a page from an external domain cannot send out information about its content, so that it can be set automatically for the iframe.

However, you can do this if you control both domains. Or if you first download the page from the other domain, so that it is on your own domain.

Conclusion:
1) Do not load a page from an external domain into an iframe on your site if you are not 100% sure what the other page is, as you may get unwanted content on your page without knowing it (= virus etc.)

2) If you still want to include a page from an external domain on your site, use a fixed height as descibed in my previous post.

3) Naturally, the page in the iframe will not display if the visitor has JavaScript disabled.


You can for example read more about that issue on this link: http://www.experts-exchange.com/Web/Q_21575822.html
iNSiPiD

Re: Including external sites

Post by iNSiPiD »

There are two problems right there with this plugin, westis. One is the double tag issue. It's confusing and unneccessary.

I believe the height parameter can be set to  auto (I believe), as can scrolling.

Two is the reliance on javascript. It's just not practical to have any site functionality javascript-reliant. Too many people and organisations disable it in their browsers.

It's only an iframe after all. How much coding does it need?
cyberman

Re: Including external sites

Post by cyberman »

You can also use piframe  - there's no javascript  ;).
westis

Re: Including external sites

Post by westis »

iNSiPiD wrote: There are two problems right there with this plugin, westis. One is the double tag issue. It's confusing and unneccessary.

I believe the height parameter can be set to  auto (I believe), as can scrolling.

Two is the reliance on javascript. It's just not practical to have any site functionality javascript-reliant. Too many people and organisations disable it in their browsers.

It's only an iframe after all. How much coding does it need?
Well, you can use embed without the header tag, which means it's not using any Javascript. But then you'd have to remove display: none in the CSS in function.embed.php, otherwise the iframe won't display.

But you can't set the height to auto, that's what the javascript is there for. But just leave out the header tag and set the height to what you want in the file (in pixels) and it simply inserts an iframe.

And yes, you can also try pi_iframe. As far as I can see it works exactly like embed, but without the javascript. The help for pi_iframe is even taken from embed, with some additions.

Also, because embed probably is meant to be used with the javascript in the header (although that parameter is optional) you can't set the height of the iframe with embed, as a parameter in the tag, but have to change in the file. With pi_iframe you can set the height and width with parameters in the tag, which is a bit easier.

So yes, inserting an iframe doesn't need much coding. And depending on the need you can use either {embed} or {pi_iframe}. :D
TheRiddler

Re: Including external sites

Post by TheRiddler »

Hi again!

Sorry!

Was a bit to fast their. The height is not working as wanted. When inserting the height:400px in line 111 in the function.embed.php file. Then I recieve the following error when trying to display the page:

Parse error: parse error, unexpected '}' in \cms\plugins\function.embed.php on line 113

I have attached the config file.

Can you guys give me an explanation on this one?

Br,
Henrik




[attachment deleted by admin]
Last edited by TheRiddler on Mon Jan 09, 2006 8:30 pm, edited 1 time in total.
westis

Re: Including external sites

Post by westis »

You have somehow removed a semi-colon at the end of line 111.

Put ; at the end of that line and it should be fine.
TheRiddler

Re: Including external sites

Post by TheRiddler »

Thx very much. A total newbie error.

I am a bit embarrassed over this. But everything is OK now.

Thx to everyone and now we better close this thread :-)

Br,
Henrik
gyszilagyi
Forum Members
Forum Members
Posts: 12
Joined: Thu Mar 23, 2006 11:12 am

Re: Including external sites

Post by gyszilagyi »

If I understand correctly this is the step that calls the javascript which would autosize the iframe (which is exactly what I need). However I got a bit lost and can't find the "other content block" you are referring to.
westis wrote:
3. In the other content block, that is below the first one (and is called headertags), add this:

{embed header=true}  This is required to load the iframe javascript!
Is this part of the page? Or the template? Could you please tell me where to look for it? Thanks!
Last edited by gyszilagyi on Sat Mar 25, 2006 7:20 pm, edited 1 time in total.
gyszilagyi
Forum Members
Forum Members
Posts: 12
Joined: Thu Mar 23, 2006 11:12 am

Re: Including external sites

Post by gyszilagyi »

OK I realised that the "headertags" content block will appear only if I turn off wysiwyg editing in the template before I edit the content page...
Locked

Return to “CMSMS Core”