home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 1744
Discussions: 188,402, Posts: 2,243,608, Members: 232,631
Old November 30th, 2004, 11:29 PM   Digg it!   #1 (permalink)
Ultimate Member
 
cracked's Avatar
 
Join Date: Nov 2001
Location: Winston-Salem, NC
Posts: 1,440
Send a message via AIM to cracked
resizing problem with iframe and td tag

hi. i am trying to put forums on my website. i have them in an iframe which is inside of a td tag for a table. the problem i am having is that i cant seem to get the td or the iframe to dynamically resize their height if the height of the forum page changes. all i can seem to do it set it at a particular height. ive tried using height="100%" on both the td and the iframe but that doesnt help. what can i do to make them be the right size?
__________________
Visit http://duroo.org

cracked is offline   Reply With Quote
Old November 30th, 2004, 11:54 PM     #2 (permalink)
Perfetc Member
 
VHockey86's Avatar
 
Join Date: Jan 2003
Location: Maryland Suburbia
Posts: 4,327
add the code so your body tag on the forum page (the page inside the iframe) so it looks like this:
Code:
<body onload="if(parent.IFRAME_size_to_content)parent.IFRAME_size_to_content('content')">
Now, on the page where the actual iframe tages are:

Put this in the header section of your page (between the <head> and </head> tags)

Code:
<script type="text/javascript" language="javascript">

function getIFRAME_doc_height(IFrameDoc) {
return (typeof IFrameDoc.height != 'undefined') ?
IFrameDoc.height + 16 :
(IFrameDoc.body && typeof IFrameDoc.body.scrollHeight != 'undefined') ?
IFrameDoc.body.scrollHeight + 30 :
null;
}

function IFRAME_size_to_content(iframe_ref) {
var IFrameDoc, oIframe = document.getElementById(iframe_ref);
if (typeof oIframe != null) {
if (oIframe.contentDocument) IFrameDoc = oIframe.contentDocument;
else if (oIframe.contentWindow) IFrameDoc = oIframe.contentWindow.document;
else if (oIframe.document) IFrameDoc = oIframe.document;

var hgt = getIFRAME_doc_height(IFrameDoc);
if (hgt) oIframe.style.height = String(hgt + 'px');
}
}

</script>
And your iframe tag....
Code:
<iframe src="forumpage.php" width="600" hieght="600" name="content" id="content" scrolling="no"></iframe>
Changing the source and width to whatever you'd like
The height doesnt really matter, it should automatically adjust when the page loads due to the script.

Realistically though, an iframe is kind a silly way to do it
You'd be better off just doing a php include. Just place the php code block whereever you want the content to be loaded into on the page (in this case, in the TD).

Code:
<?php include("forumpage.php"); ?>
Assuming your server supports php and then save your page that loads the forum as .php

VHockey86 is offline   Reply With Quote
Old November 30th, 2004, 11:58 PM     #3 (permalink)
Ultimate Member
 
cracked's Avatar
 
Join Date: Nov 2001
Location: Winston-Salem, NC
Posts: 1,440
Send a message via AIM to cracked
nevermind, got it

http://www.geeklog.net/article.php/20030213110315177

those guys are awesome

thanks anyway

EDIT: thanks VHockey, but i already got it. i had tried using an include but phpbb2 is funny and everything looked messed up when i tried it and the links didnt work well. but thanks again!!


Last edited by cracked : December 1st, 2004 at 12:00 AM.
cracked is offline   Reply With Quote
Old December 1st, 2004, 10:53 PM     #4 (permalink)
Ultimate Member
 
cracked's Avatar
 
Join Date: Nov 2001
Location: Winston-Salem, NC
Posts: 1,440
Send a message via AIM to cracked
i added forums to the site. check em out and lemme know what u think. the iframe resizer slows it down just slightly but i think thats better than having to scroll so much...
cracked is offline   Reply With Quote
Reply


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

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scrollbar Color For Iframes magicz69 Webmastering and Programming 14 April 19th, 2008 12:39 PM
Dreamweaver help soulja Webmastering and Programming 2 September 1st, 2004 01:23 AM
Scroll Bar for text Rdaws Graphic Design and Digital Photography 7 June 1st, 2004 11:37 AM
Alternative to using an IFRAME....suggestions? Tekk Webmastering and Programming 4 March 1st, 2004 04:13 AM
how can i embed this? shawshank62 Graphic Design and Digital Photography 2 December 6th, 2003 07:08 PM

Most Active Discussions
Is It Just Me? (2906)
Unarmed man on his stomach shot by .. (6)
Misery Loves Company... (2144)
New Build ( Finally ) (7)
CPU wont boot (7)
Building a gaming computer advice (5)
I think I just killed my computer w.. (24)
RCA 52Inch HDTV wont turn on (5)
Folderchat Weekday thread (444)
Recent Discussions
Please help! multiple problems! (4)
How to transfer music from iPod.. (0)
RCA 52Inch HDTV wont turn on (5)
New Build ( Finally ) (7)
Common Spyware Solutions (97)
How do you move a hard-drive to.. (4)
Laptop proccesor to desktop mob.. (1)
What is the best external enclo.. (0)
Partition Magic 7.0 (Unallocate.. (17)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 04:01 AM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28