How to have an iframe included with automatic height/width

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.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

How to have an iframe included with automatic height/width

Post by RonnyK »

I have used the {pi_iframe}-tag and see that the height of the iframe isn't reflecting the height of the page that is included. Is there a way to have the iframe to show without the scroll-bars and have the full height of the page included. I now gave a fixed height of the max height used, but if the page is not that heigh, you'll end up with a lot of whitespace below the content. I basically want the frame to behave like normal content, so flexible in height and no scrollbars.

Ronny
cyberman

Re: How to have an iframe included with automatic height/width

Post by cyberman »

Embed tag (provided with default CMSms install) has such an option ... please look at tag help.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: How to have an iframe included with automatic height/width

Post by RonnyK »

Cyberman,

i had tried the embed-tag, but that didn't work as well. I entered the "header=true"-part in the metadata of the content-page, but the iframe didn't go down, it only extends to the height of the menu/sidebar.

I'll create another page with this logic and will post the link to see..

http://work.krijt.eu/index.php?page=beach-lot-embed

Template now:

Code: Select all

{metadata}
<!-- Don't remove this! Metadata is entered in Site Admin/Global settings. -->
Metadata of page:

Code: Select all

{embed header=true}
Content of page:

Code: Select all

<p>{embed url=http://www.nu.nl}</p>
While page www.nu.nl is longer than is just shown in the calling of the embed-tag....


Ronny
Last edited by RonnyK on Wed Jun 13, 2007 7:50 am, edited 1 time in total.
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: How to have an iframe included with automatic height/width

Post by Gregor »

Ronny,

I tried something similar with a UDT:

Code: Select all

echo '<__iframe width="100%" height="265" frameborder="0" src="poll/demo_1.php"></__iframe>';
It is possible to use
height="100%"
www.wsv-herkingen.nl

Does this help?
Gregor
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: How to have an iframe included with automatic height/width

Post by RonnyK »

Gregor,

can you show me the way your UDT looks, and the calling of the page. I tried to put iframe directly in the content-page, but it still doesn't show the entire height.

Ronny
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: How to have an iframe included with automatic height/width

Post by Gregor »

Of course

I put {poll} in the template.

Code: Select all

      </div>
       <!-- End Content Area -->
   </div>
   <!-- End Content -->
   <!-- en nu de rechterkant maken voor de content -->
   <!-- 19-03-07 toegevoegd -->
   <div id="rightcontent">
       {content block='Rechter content'}
       {poll}
       <!-- Adsense van Google toegevoegd op 16 apr 2007 -->
       {adsense ad_client="pub-3514636835854223" ad_width="120" ad_height="240" ad_format="120x240_as"}
   </div>

   <!-- Start Footer. Edit the footer in the Global Content Block called "footer" -->
Gregor
alby

Re: How to have an iframe included with automatic height/width

Post by alby »

RonnyK wrote: Cyberman,

i had tried the embed-tag, but that didn't work as well. I entered the "header=true"-part in the metadata of the content-page, but the iframe didn't go down, it only extends to the height of the menu/sidebar.

I'll create another page with this logic and will post the link to see..

http://work.krijt.eu/index.php?page=beach-lot-embed

Template now:

Code: Select all

{metadata}
<!-- Don't remove this! Metadata is entered in Site Admin/Global settings. -->
Metadata of page:

Code: Select all

{embed header=true}
There is a smarty error in a javascript in header:

Code: Select all


string(372) "Smarty error: [in metadata template line 7]: syntax error: unrecognized tag: //find the height of the internal page
  var the_height=
    document.getElementById('the_iframe').contentWindow.
      document.body.scrollHeight;

  //change the height of the iframe
  document.getElementById('the_iframe').height=
      the_height; (Smarty_Compiler.class.php, line 439)"
string(116) "Smarty error: [in metadata template line 7]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 583)"
<meta name="Generator" content="CMS Made Simple - Copyright (C) 2004-6 Ted Kulp. All rights reserved." />
A comment?

Alby
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: How to have an iframe included with automatic height/width

Post by RonnyK »

Alby,

thanks for checking, I was "playing" with some height-scripts. I now have embedded the page I want to include, that is NOT working, but with the test-page I tried, www.nu.nl I noticed that the embed, as the other scripts, don't go "all the way down". I now included the good page, which luckily for me, is not as big is the nu.nl page.

http://work.krijt.eu/index.php?page=nu-nl

shows that it is not the full page that www.nu.nl shows original.

The CSS for the iframe:

Code: Select all

#myframe {
  height: 100%;
}
Ronny

I now see that the other page isn't working either as the default is something like 600px. The page is bigger.
Last edited by RonnyK on Wed Jun 13, 2007 10:02 am, edited 1 time in total.
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

Re: How to have an iframe included with automatic height/width

Post by tsw »

IIRC there is a problem with iframes from different domains. JS security options disable doing too much to the content of iframe if the source is not on the same domain, including the height query.

last time I had to do something like this it couldnt be done (but that was like two years ago)
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: How to have an iframe included with automatic height/width

Post by Gregor »

I did a test with
http://www.wsv-herkingen.nl/index.php?page=nu

I put a UDT {nu} with the following code

Code: Select all

echo '<__iframe width="100%" height="100%" frameborder="0" src="http://www.nu.nl"></__iframe>';
in the template. The site nu.nl can bescrolled inside the page area (not on the correct place, have no time to solve that one).

Does this help?
Gregor
Last edited by Gregor on Wed Jun 13, 2007 11:02 am, edited 1 time in total.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: How to have an iframe included with automatic height/width

Post by RonnyK »

Gregor,

that is exactly my issue, i would expect no scrollbar, with the height=100%, I wanted the height to be as high as required.

Ronny
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: How to have an iframe included with automatic height/width

Post by Gregor »

Ronny,

OK, that's the point. What I did to solve it at the wsv-site, I made the iframe area a little larger (in the template). However, if this is not going to work because of the size of the page you want to include, maybe this might help:
http://www.thescripts.com/forum/thread145283.html

I add
scrolling="no"
to the iframe code and now it has no scrolling abillities. I only see a part of the nu.nl-site, might that have to with the site desing of nu.nl???

Gregor
Last edited by Gregor on Wed Jun 13, 2007 11:35 am, edited 1 time in total.
cyberman

Re: How to have an iframe included with automatic height/width

Post by cyberman »

It's much more tricky, but another way could be to rip content of page you wanna include via php like I've try it here

http://test.cmsmadesimple.de/index.php?page=estate-page

(Yes, I know - all links are broken and page is not valid, but it's only a simple working draft :).)
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: How to have an iframe included with automatic height/width

Post by Gregor »

oops, Cyberman, the link dos not work at all  ;)
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: How to have an iframe included with automatic height/width

Post by RonnyK »

Thanks Cyberman,

I'll check that. The only quick disadvantage of that method I see is that links that are clicked in the page "included", are not linkable, as they link relatively, so to your own page instead of remaining inside the iframe/embed.

Ronny
Post Reply

Return to “CMSMS Core”