Page 1 of 1
Including external sites
Posted: Sat Jan 07, 2006 5:12 pm
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.
Re: Including external sites
Posted: Sat Jan 07, 2006 6:47 pm
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!
Re: Including external sites
Posted: Sat Jan 07, 2006 7:17 pm
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
Re: Including external sites
Posted: Sun Jan 08, 2006 10:51 pm
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?
Re: Including external sites
Posted: Mon Jan 09, 2006 8:37 am
by cyberman
You can also use piframe - there's no javascript

.
Re: Including external sites
Posted: Mon Jan 09, 2006 12:03 pm
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}.

Re: Including external sites
Posted: Mon Jan 09, 2006 8:28 pm
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]
Re: Including external sites
Posted: Mon Jan 09, 2006 9:37 pm
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.
Re: Including external sites
Posted: Mon Jan 09, 2006 10:30 pm
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
Re: Including external sites
Posted: Sat Mar 25, 2006 2:23 pm
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!
Re: Including external sites
Posted: Sat Mar 25, 2006 7:52 pm
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...