Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Web Design (WordPress, Joomla, etc.) iFrame vs PHP include

  • iFrame vs PHP include

    Posted by Bret Williams on April 21, 2005 at 7:02 pm

    I’m adding a menu of products to a site redesign and have used the PHP include function in the past. Since it seems that an iFrame can accomplish exactly the same thing, and also function more like frames, would it be a better choice? What’s the advantage of using a php include function (if there is one).

    There is a funky issue as well. When I use the iFrame, I specify the height. If I don’t then it fits the insterted page, but, the page (menu) automatically expands and contracts via CSS to expose more choices. When it does this in an iFrame, it stays the same height, but adds a scroll bar.

    If there is a way to make an iFrame expand and contract dynamically I think it might be the winner. Making the iFrame height 100% gave me nothing.

    Curtis Thompson replied 18 years, 1 month ago 2 Members · 3 Replies
  • 3 Replies
  • Curtis Thompson

    April 21, 2005 at 7:09 pm

    hello…

    i guess i’d play devil’s advocate and ask why (assuming that your pages are already php anyway) you’d even mess with iframes, as a simple include file can be changed as easily as an iframe and then you don’t have to worry about very ancient browsers or wackiness between browsers when it comes to iframes? the include will be seen as transparent html in the end, and that would seem to save you a lot of headaches..

    now if the site wasn’t already php, then an iframe is a handy way to get a single nav menu file going…and in that case, with your scrolling issue, i think i’d just try making your iframe height the maximum height the nav menu could be with all its sub menus expanded – then there won’t ever be a need for it to scroll as it’s height is safely covering the worst case scenario…

    if i’m following you correctly on that scroll isssue, that is…

    sitruc

  • Bret Williams

    April 21, 2005 at 7:14 pm

    Good call. You’re following everything correctly, and it’s a completely brand new site, so I can make all the pages be .php no problem. I’m new to iFrames and you’ve answered it pretty well with the browser wackiness comment.

    I was just coding all the menu items just now and realized I had to pick either .html or .php as the extension and decided to check the forum. .php it is. Can’t hurt even if I change my mind later.

  • Curtis Thompson

    April 21, 2005 at 7:45 pm

    hello…

    iframes are pretty good and i’ve used them a lot in the past, so i should qualify that they work nicely – but there are always subtle little things between browsers in them (like borders is one thing i can think of), and much older browsers won’t like them at all, so if i personally had the option to not use them and have an include php bit that still gave me the template effect, i’d go for that just because i know i’d sleep easier… 🙂

    sitruc

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy