Old 29-03-2006, 11:32   #1 (permalink)
adamtrance
Registered User
 
Join Date: Mar 2006
Posts: 10
iframe that pushes frames

Hello developer fellows,
I came here to seek some help for a problem, because its making me nuts.
Now, I only do webdesign as a hobby and I know the basics but this problem is a bit advanced for me so Im wondering if you guys would be kind enough to help me out.

Ok, so there is a page and there are static objects that dont reload again like buttons headers etc, and a dynamic part of the page like the content pages. The easiest way to solve this is to insert an iframe. So when I click a button only the stuff in the iframe change and the entire page doesnt have to load again.

Now, what i want is that is it possible to have an iframe that when the content is bigger than the iframe, instead of scrollbars the iframe adjusts to the height of the content?
Or if its not possible to solve it with an iframe another option would be good, but it should have the same function as an iframe because the design of my page is the most important at the moment.

Thank you in advance!
Adam

Last edited by adamtrance : 29-03-2006 at 15:11.
  Reply With Quote
Old 29-03-2006, 11:38   #2 (permalink)
Stickman
Dr. Lucien Sanchez
 
Stickman's Avatar
 
Join Date: Mar 2003
Location: UK
Posts: 5,563
Quote:
Originally Posted by adamtrance
Ok, so there is a page and there are static objects that dont reload again like buttons headers etc, and a dynamic part of the page like the content pages. The easiest way to solve this is to insert an iframe. So when I click a button only the stuff in the iframe change and the entire page doesnt have to load again.
Reloading a few elements is better than arsing about with frames. Frames can be inaccessible and anything you're reloading will be cached anyway.

If you want to reuse the same bit of code, you could look at php includes.
http://www.google.co.uk/search?hl=en...Search&meta =
  Reply With Quote
Old 29-03-2006, 11:39   #3 (permalink)
datahound
Spare Parts
 
datahound's Avatar
 
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 5,118
Does your server support PHP?

The other way to do it is with server side includes shtml.
  Reply With Quote
Old 29-03-2006, 11:44   #4 (permalink)
pgo
Senior Member
 
Join Date: Jan 2005
Posts: 12,340
Quote:
Originally Posted by datahound
The other way to do it is with server side includes shtml.
Dreamweaver templates (.dwt) would work as well if your goal is making your life simpler - not having to reuse a bunch of code.

PHP includes (or similar) would be your best bet, though.
  Reply With Quote
Old 29-03-2006, 14:41   #5 (permalink)
adamtrance
Registered User
 
Join Date: Mar 2006
Posts: 10
Heh, sorry I guess I didnt explain myself good.
You see I cannot use images that reload again because what I want to create is that when I click on a button, the header image slowly fades to another image. So If I reload the whole page its not gonna work. At least the buttons and the header have to be left seperately and not load them over and over again for this to work.
I have attached an image to show you guys what I mean.
Like when the content is larger the height of the page automatically adjusts, thus it doesnt reload the buttons and the header.
Is this possible?
(also please note that PHP is not my strenght so I may need some help with that.)
Attached Thumbnails
iframe-pushes-frames-website.gif  
  Reply With Quote
Old 29-03-2006, 19:23   #6 (permalink)
LadynRed
Senior Member
 
Join Date: Mar 2006
Posts: 147
There is a way to do this, but it's going to take scripting. I did the exact thing on an old intranet site 4 years ago and it worked like a charm, and it was a bit of a pain to get it working correctly. Frankly I'd stay away from iframes, you can't bookmark pages and you louse up your history (back/forward buttons). I had to have an additional script to make those work.

If you REALLY gotta do that, I might be able to dig up the old site files.
  Reply With Quote
Old 30-03-2006, 04:42   #7 (permalink)
adamtrance
Registered User
 
Join Date: Mar 2006
Posts: 10
ah cheers i would very much appreciate if you could do that for moi
  Reply With Quote
Old 30-03-2006, 10:36   #8 (permalink)
LadynRed
Senior Member
 
Join Date: Mar 2006
Posts: 147
Well, looks like I can't attach a text file so here's the code:

Put this in the HEAD:
Quote:
<script language="Javascript">
<!--

// Dynamic Iframe loader
function loadIframe(theURL) {
document.getElementById("mainContent").src=theURL;
}

// resizes Iframe according to content
function resizeMe(obj){
docHeight = mainContent.document.body.scrollHeight
obj.style.height = docHeight + 'px'
}
</script>

Define and position your iframe (use your own settings, obviously):
Quote:
<iframe id="mainContent" name="mainContent" onload="resizeMe(this)" style="position:absolute; left:180px; top:150px; width:625px; height:764px; z-index:3; overflow: auto" frameborder="no" scrolling="no" src="yourpage.html"> </iframe>

Then, to call pages into the iframe you need to set up your links like this:
Quote:
<a href="javascript:loadIframe('xxx/xxxxxxx.htm')">

That should work, if not let me know but I don't think I've forgotten anything
Just keep in mind that the BACK button will not work right, it will not take them back one in the iframe 'history', you'd need another script and buttons (which I did) to emulate 'history'.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8