Page 1 of 2

Dynamic Web Page Lengths

Posted: Tue May 08, 2007 7:38 am
by rockman
A standard format for a website is a header section, body section, and footer section. Since WWB excels in creating Fixed Page Layout HTML, designers usually have to manually adjust their body section and footer section based on the amount of content contained on a particular page. The following code performs dynamic (automatic) placement of the footer and stretching of the body based on the height of a main inline frame.

Here are screenshots of an example:
Image
The footers and body automatically adjust depending on the amount of content contained on the page.

The key is placing the following HTML code in the inline frame's "Inside Tag":

Code: Select all

onLoad="this.style.height=0; this.style.height=Content.document.documentElement.scrollHeight; Layer2.style.height=parseInt(this.style.height) + (parseInt(this.style.top) - parseInt(Layer2.style.top)) * 2; Layer3.style.top= parseInt(Layer2.style.top) + parseInt(Layer2.style.height)"

To see an example website using this technique (based on Pablo's Inline Frame sample), click on this link:
http://www.cardiackids.com/wysiwyg/dynamicpagelength/
To have a copy of the .wbs file that created the website, download it here**:
http://www.cardiackids.com/wysiwyg/dyna ... length.zip

Special notes:
1. There are three layers on the page (Header, Body, and Footer) and a main inline frame (Content).
2. In the code above, replace "Content" with the name of your inline frame.
3. In the code above, replace "Layer2" and "Layer3" with the id's that WWB assigns your body and footer layers, respectively. To find the id's, refer to the Quick Properties window or the Object Manager window.
4. The inline frame cannot be a member of a layer and must be a higher z-order (on top) than the layers. Therefore, when designing, make your body layer rather short (it will stretch automatically later) and make your inline frame taller than the body layer. In this way the inline frame does not become a member of the layer.
5. When designing the page, place the inline frame down from the top of the body layer as to make a "top margin". The code listed above uses this same distance to create a "bottom margin" - distance between the bottom of the inline frame and footer.
6. The code has been tested in Internet Explorer. It has not yet been tested in Firefox and Opera.

**P.S. I have since changed the file download to a .zip file to include the graphics. If you have problems downloading or working with the demo, please let me know.

Posted: Sun May 25, 2008 7:08 pm
by haakoo
Hi,

Don't know for sure,it seems FF3 is more strict then FF2.
Tested something in 2 and it worked,didn't get a warning or error.
tested exactly the same thing in 3 and threw me an error as the function could not be executed.
When testing it online,FF3 didn't throw me errors anymore.

But this dynamic iframe didn't make it offline nor online,think it needs some tweaking or it's history

Hans

Posted: Sun May 25, 2008 7:17 pm
by kees
Does it work with FF3 with this url: <...link removed...>

EDIT
See my message at viewtopic.php?p=43231#43231

Posted: Sun May 25, 2008 7:37 pm
by haakoo
Hi Kees,

Everything but mijn kind online.
Think it's an html issue, since you're using little html with xml and php

Hans

Posted: Sun May 25, 2008 7:46 pm
by kees
But does the Iframe height change on every new choise? That's the point in this discussion.

The JavaScript code used to work in IE6/7 and FF2, but not in Opera.

The JavaScript in the url above has some improvements, to make it work in Opera. But does it work in FF3 as well?

Does the Iframe resize in both directions (larger and smaller)?

Posted: Sun May 25, 2008 7:57 pm
by haakoo
Only the height changes and it's static to the left(ne centering)

Hans

Posted: Sun May 25, 2008 8:01 pm
by kees
Do you mean that this solution can fix the problem?

Posted: Sun May 25, 2008 8:14 pm
by haakoo
Hi Kees,

Tried(the example download) on the server and works now
(maybe FF3 had to install some updates??)
Gives warnings about the scrollbar thingies(no issue)
Only other warning is the use of name/id usage in the global scope and to use getElementById instead

Hans

Posted: Sun May 25, 2008 10:13 pm
by kees
To test my solution, you can download the fixed *.wbs file from here.

It was tested in IE6/7, FF2 and Opera9 (all latest versions at the moment).

Comments are appreciated.

Posted: Sun May 25, 2008 10:25 pm
by haakoo
This is the warning i get,it works.

Code: Select all

Waarschuwing: Door ID/NAME in de globale scope gerefereerd element. Gebruik in plaats daarvan document.getElementById(), volgens de W3C-standaard.
Bronbestand: http://www.splitmedia.nl/loadingdock/testsizingiframe/
Regel: 1

Hans

Posted: Sun May 25, 2008 11:02 pm
by kees
Just to clearify: a warning isn't an error. A warning is an advice, a recommendation.

For WebBuilder users I try to avoid getElementById(), because it's far beyond the WebBuilder concept.

Thanks for your feedback anyway.

Posted: Mon May 26, 2008 10:17 pm
by kees
Fabry67 wrote:... what's wrong with using a GetElementByID ?
If we can avoid 'GetElementById' (or other references to object names or id's) we have a generic script, that works on any Iframe. Otherwise the script has to be adjusted to each specific Iframe. Agree?

That's why I replaced 'IframeName.document.body.scrollHeight' with 'this.contentWindow.document.body.scrollHeight'.
Fabry67 wrote:Anyway, the only annoying thing with this solution is the "flicker" effect.
Yes, but I'm happy with this trick anyway.
Fabry67 wrote:I also have the doubt that on slow connections or on much more complex pages, a fixed delay (150ms) wouldn't be enough.
The 150ms was found by experiment. Do you suggest a higher value?

Posted: Thu Jun 19, 2008 9:55 pm
by kees
A few days ago there were new updates of FireFox (3.0) and Opera (9.50).

I tested the original example from rockman's message ( viewtopic.php?p=16739#16739 ) with these latest versions and found that it works fine.

That means that my 'fix' ( viewtopic.php?p=43231#43231 ) has become redundant.

Can anyone confirm that rockman's example is working on all mayor browsers (FF6/7, FF3, Opera9.50, ???).

Thank you.

Posted: Fri Jul 04, 2008 5:42 am
by kees
dangermouse wrote:Is it possible for this concept to work with php and can i instead of calling an inline frame call a html box with some php code in it will that work ?
This concept is based on an Iframe and only works with an Iframe.

PHP is not involved in this concept, but can be added (as in any page).

Nice

Posted: Sat Jul 26, 2008 10:21 pm
by star57
Finally had time to try this, and the first instructions was to the point and very easy to follow. Works great... Thanks for the example...

Posted: Wed Jul 30, 2008 6:21 pm
by Patr100
Ok I haven't tried any of the above yet, and I suspect this is a non starter - We all know WB5 is a fixed design html builder but is there any way of using a similar principle and adding some manual code tweaks etc to make a page made for say 800 pixels wide , stretch a little more HORIZONTALLY to fill a widescreen so there at least isn't such an obvious gap either side of a centred in browser page?

Posted: Wed Jul 30, 2008 9:20 pm
by Navaldesign
If you mean if there is a way of automatically increasing the page width to cover the entire screen width, whatever the sceen size/resolution is, the answer is no. But you can make a WB page wider, and set it to whatever width you like, not only 800.

Posted: Wed Jul 30, 2008 10:00 pm
by Patr100
Navaldesign wrote:If you mean if there is a way of automatically increasing the page width to cover the entire screen width, whatever the sceen size/resolution is, the answer is no. But you can make a WB page wider, and set it to whatever width you like, not only 800.
Yes but that would cause scrolling on a smaller screen res of course. Guess there no way of avoiding a compromise with fixed positioning & WB5.

Posted: Fri Aug 01, 2008 2:06 pm
by Navaldesign
Did you place the footer page content on the very top? If you have placed it low (where you expect it to appear) and on the same time the masterpage object is placed at the bottom of your page, the white space is doubled.

Posted: Sat Aug 16, 2008 2:49 pm
by Eddy
this part is in one page in layer2 and in the other page in layer3 if I see it right. :? maybe you check this.

Code: Select all

<iframe name="Content" id="InlineFrame1" style="position:absolute;left:207px;top:151px;width:548px;height:120px;z-index:11;" src="http://www.menkom.com/dump/test6/home.php" scrolling="no" frameborder="0" onLoad="this.style.height=0;this.style.height=this.contentWindow.document.body.scrollHeight;Layer2.style.height=parseInt(this.style.height) + (parseInt
(this.style.top) - parseInt(Layer2.style.top)) * 2;Layer3.style.top= parseInt(Layer2.style.top) + parseInt(Layer2.style.height)">Your browser does not support inline frames or is currently configured not to display inline frames.</iframe>

Posted: Sun Aug 24, 2008 12:00 am
by Eddy
How do i point the iframe to an exteral site ?

This question was the problem you asked ,to link to an externel site and I was also searching how todo this,you found not a solution to this problem you stil link internal because its on your server and that was never a problem.

Maybe somebody els nows how to open an external site in the dynamic iframe?

Posted: Sun Aug 24, 2008 10:10 am
by kees
dangermouse wrote:You cannot link your iframe to WWW.GOOGLE.COM or WWW.MICROSOFT.COM because the rest of your website is not hosted on the microsoft.com servers.
I didn't follow the recent discussion between Eddy and dangermouse, so maybe this is an irrelevant comment.

Links to external pages must have the http:// prefix.
So http://www.google.com will work, www.google.com doesn't work.

Posted: Sun Aug 24, 2008 10:59 am
by haakoo
Hi,

Something like this?Take look at page 4;
http://www.splitmedia.nl/loadingdock/dynamicpages/

Hans

Posted: Sun Aug 24, 2008 12:43 pm
by Eddy
haakoo wrote:Hi,

Something like this?Take look at page 4;
http://www.splitmedia.nl/loadingdock/dynamicpages/

Hans
U did put on page 4 an iframe and link external to the forum,this works also but you have not the dynamic vieuw in the indexpage ,If we can link external without an extra iframe so that the indexpage expands to the site lenght.
For me is the trick with the extra iframe a good solution. :wink:

Posted: Sun Aug 24, 2008 4:13 pm
by haakoo
Hi Eddy,

Depends on how the size of your IFrame is,
Then you can load anything.
The only downside,you cannot control the width or height of the site that loads into the IFrame
Nor can you control,if the developer of the site used a break-out-of-frame script.
But the extra IFrame is a good swift solution

Hans

Posted: Wed Oct 22, 2008 9:27 am
by Eddy
You have to rebuild your menu to open all your pages in the iframe on your index page.
Look with the site manager to the structure from the files.
And look to where the buttons link in the example.
Pleasy read this topic,almost all questions are asked.

Posted: Sat Mar 14, 2009 12:21 pm
by Eddy
Here's how you can create an inline frame with a transparent background.
This will allow you to create scrollable text with the background of your main page showing through.

viewtopic.php?t=576

Posted: Fri May 22, 2009 5:43 am
by Eddy
metatron, this dynamic ifame das not work with external pages/websites.

chris_saturn,maybe you are looking for this,but I dont know if u can use this together with the dynamic iframe code:

Sub-pages should open in an Inline Frame
viewtopic.php?t=1445

Or you disable the subpages to get listed in google with robots.txt / metatags dont follow.

Posted: Sat May 30, 2009 10:16 pm
by Eddy
Can u not use:
$new_height = 100%;

Why do u use this,for faster loading times?

Posted: Sun May 31, 2009 12:41 pm
by Eddy
The first page from your website is at te most servers index, the page extension can html,php,asp etc .

With the php code I cannot help you,but I think you need something like new height is iframe height in the code.

An easy solution is to use the same bg color as the bottom from you bg image than you dont have to expand the height from your image.

Posted: Wed Jun 03, 2009 12:24 am
by Eddy
chris_saturn,

Al menu links what I try dont work on your page with dynamic frame?
Testen in IE and FF.

Only on gallery photos das work.

Posted: Wed Jun 03, 2009 6:45 pm
by Eddy
On firefox all pages are opening,in IE6 al links do nothing only photos shows up.

Posted: Sun Sep 20, 2009 8:46 pm
by Eddy
I dont know if its possible to make it work in xhtml.

You can try with this html doctype:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Empty the doctype in page properties and insert the doctype above in: Page html-->between head tag.

Posted: Thu Sep 24, 2009 6:13 pm
by Eddy
Page properties-->Document type: None

Posted: Fri Sep 25, 2009 8:11 am
by Eddy
Sorry ,than I dont know how to make it work with the dynamic iframes.

Posted: Thu Oct 01, 2009 1:48 pm
by Eddy
Please read this topic back ,rsomat did ask the same question about xhtml and html with dynamic iframes.

Posted: Thu Oct 01, 2009 2:12 pm
by Eddy
Its the same if you use another extension what not works in FF or safari and your extension das not work in google chrome with doctype XHTML

A script what is build for doctype XHTML wil not work in doctype HTML what you can try is to give the doctype an url.

You can try with this html doctype:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


Empty the doctype in page properties (Document type: None) and insert the doctype above in: Page html-->between head tag.

Posted: Thu Oct 22, 2009 11:07 am
by Eddy
link an external website into the dynamic iframe does not work.

Read from here.
viewtopic.php?t=4060&postdays=0&postorder=asc&start=45

Posted: Fri Apr 09, 2010 4:50 am
by iamafireman
I have tried both as well and they dont work. Any way to get an example that works with 6.5

Posted: Mon Jun 28, 2010 10:13 pm
by Patr100
The new "content place holder" & "master frame" option in WB 6 and above does add some built in dynamic capacity to pages.

but as the original option in this thread no longer works I think this thread really should not be a "sticky" any more or an updated thread with options for dynamic pages replaces it asap.

Posted: Wed Jul 07, 2010 7:29 pm
by Pablo
Master pages and content place holders cannot be used together.
Content Placer Holders can only be used in combination with Master Frames.
http://www.wysiwygwebbuilder.com/master_frame.html

Also please do not use this topic for support question which are not related to the original article. It's getting a little confusing this way :?

Posted: Wed Jul 07, 2010 9:28 pm
by Patr100
Could support please respond to my post above about this thread. The original example appears not to work any more. so why is this still a sticky?

Posted: Thu Jul 08, 2010 8:15 am
by Pablo
The problem is not WYSIWYG Web Builder 7.
The code doesn't work because it's not W3C compliant.

Posted: Sat Aug 28, 2010 2:32 pm
by Patr100
support wrote:The problem is not WYSIWYG Web Builder 7.
The code doesn't work because it's not W3C compliant.
Ok but it either needs updating or not a sticky any more as presently it doesn't work.

Re: Dynamic Web Page Lengths

Posted: Wed Nov 17, 2010 6:54 am
by Pablo
What you are asking is not possible in a What-You-See-Is-What-You-Get web site editor.
Since all objects are positioned absolute, they cannot be repositioned dynamically based on the content of another object. This can only be done with table based layouts.

Re: Dynamic Web Page Lengths

Posted: Thu Dec 30, 2010 12:02 pm
by rockman
From the author:

My apologies to those who have had difficulties getting this code to work more recently. Indeed, the original code and sample .wbs file, written in 2007, was no longer compatible with later versions of WWB and/or the HTML language. I have found a solution and have replaced the initial zip file with an updated one. The link is repeated here for convenience: http://www.cardiackids.com/wysiwyg/dyna ... length.zip

As before, it has been tested with Internet Explorer.

Good luck on all your projects.

Re: Dynamic Web Page Lengths

Posted: Wed Mar 02, 2011 6:05 am
by [RZ]
this is because the scrollheight function is not fully supported by all browsers.
i.e. it was introduced later in IE in version 8.
in some browsers you can access it via .contentWindow.document in others via .contentDocument in other browsers is not supported at all and so on....
regards.

Re: Dynamic Web Page Lengths

Posted: Sat Jul 09, 2011 9:51 am
by Patr100
I think you will be told again by support that is simply not possible with the way WB works - as you know similar questions get asked frequently.