ClanKiller.com https://forums.plasmasky.com/ |
|
phpinclude and/or iFrame issues https://forums.plasmasky.com/viewtopic.php?f=8&t=2872 |
Page 1 of 1 |
Author: | Mole [ Tue Jul 22, 2008 12:14 pm ] |
Post subject: | phpinclude and/or iFrame issues |
Right, first off I know iFrames suck, but I may HAVE to use one here. here's the website http://www.d-mas.co.uk here's the page I want to display as inserted in to the main page http://www.d-mas.co.uk/blog The problem is this: When I use an iFrame, it inserts the page correctly formatted with all the trimming just the way I like it. the only problem, is it has scroll bars on the right, and you have to scroll down the blog individually to the rest of the website. If I use phpinclude, it inserts the page without the scroll bars, however, it's the right length and everything. I need to somehow merge the two. I need the fact that the iFrame inserts all the correct formatting (as the blog/index.php is getting it's formatting from it's own directory, you see) but It also needs to account for the fact the blog can be any length, depending on how much news there is and how long the last 5 posts are. Where do I start?! |
Author: | RB [ Tue Jul 22, 2008 1:02 pm ] | ||||||||||||||||||
Post subject: | |||||||||||||||||||
When you include the page B (http://www.d-mas.co.uk/blog/) on PHP level to the page A (http://www.d-mas.co.uk/), formatting sucks because you use relative address(es) to link CSS in the page B. Make it absolute and it will start loading everywhere else. Still it won't be a neat solution because it would load B's headers and all stuff into the page A that already has its own. You need to bypass it. What you can do is to separate page B into "headers and footers" and "content" and then load them in a proper oder. A rough illustration: blog/index.php
Now, you'd just need to update CSS in the page A a bit (to load the stuff that page B uses) and just to load the "content" part from page B into A. A rough illustration: index.php
I'd never use iframe for this. |
Author: | Satis [ Tue Jul 22, 2008 1:03 pm ] |
Post subject: | |
javascript. Using javascript you can automatically resize the iframe to the size of its contents. Ok, so basically we need to put an onload handler on the iframe so that when it loads, it triggers the javascript. <iframe onload='resizeIframe()' src='whatever'></iframe> The magic of course happens in the javascript function. This kinda works and should give you a basic idea <script type='text/javascript'> function resizeIframe(el){ //get the dimensions of the iframe's contents el.style.width = this.document.body.scrollWidth + 'px'; el.style.height = this.document.body.scrollHeight + 'px'; } </script> el references the iframe tag... thus i'm setting with css width and height on the tag. 'This' references the iframe contents, and I'm measuring the scrollWidth and scrollHeight. The height doesn't seem to work too well in IE7 and the width seems to just automatically fill up the whole page in both IE and FF3. ![]() For more info, check this out: http://www.faqts.com/knowledge_base/view.phtml/aid/1076 http://www.webmasterworld.com/forum21/5653.htm http://www.webdeveloper.com/forum/showt ... p?t=171093 |
Author: | Mole [ Tue Jul 22, 2008 1:14 pm ] |
Post subject: | |
Thanks guys ![]() Cheers again ![]() ![]() ![]() |
Author: | RB [ Tue Jul 22, 2008 1:19 pm ] |
Post subject: | |
Satis' solution is doubtlessly bit more expensive for visitor's CPUs and RAM and might not work everywhere but it should be fairly easy to implement. What I suggest would need more work, especially if you didn't write the source of your blog (in that case you might call it 'mission impossible' at some point), but it guarantees simpler look from outside and will work in any browser it was working in before. |
Author: | Satis [ Wed Jul 23, 2008 7:52 am ] |
Post subject: | |
haha, funny...Gfree and I posted completely different solutions at the same time. Personally, I think iframes shouldn't be used... I'd rather pull in the external pages via curl, parse them up in php and then take the chunks you want to keep and insert them into your page. That's basically what gfree was getting at, if I'm not mistaken. The iframe solution I had is a lot easier and I figured it was more along the lines of what you're looking for. It's not the best solution, though. Anyway, good luck with that. |
Author: | Mole [ Thu Jul 24, 2008 12:06 pm ] |
Post subject: | |
Yeah, I'm not a fan of iFrames either. Problem is my brain is frazzled and I think I need to start from scratch on anything webdesign, as it's just not making sense to me ![]() Well, I get the idea, but I'm finding it a bitch to implement because I have no idea what I'm doing any more ![]() |
Author: | Satis [ Thu Jul 24, 2008 6:42 pm ] |
Post subject: | |
heh...did you ever? ![]() I'm available for hire. The weak dollar makes me a bargain. ![]() |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |