What's the best way to use PHP includes instead of iFrames?
Edit:
Instead of using iFrames, I want to use includes to show my content.
What's the best way to use PHP includes instead of iFrames?
Edit:
Instead of using iFrames, I want to use includes to show my content.
In short, they are orthogonal.
PHP includes, include a PHP file inside another PHP file, the entire set of code is then interpreted and run as one, typically some output is generated by the script and then returned as a single entity in response to the original request which invoked your script at the top of the inclusion chain.
IFrames create a secondary browser context on the client side, enabling you to have multiple states on the client side, essentially allowing you to run several applications within a single view - or create a view which comprises multiple browser contexts.
In english ;) consider PHP includes as a single script split over multiple files, consider IFrames as having multiple browser tabs displayed within each other - here's a handy illustration of IFrames from dan brickley which will hopefully help illustrate.
As a UI Engineer, I would argue that there's more than just a technical explanation to iFrames. Sure, they have a purpose....albeit a limited one, I might argue. Think about all the great sites you know of out there.....people might name sites like Apple, Nike, Google, Twitter....you pick them, but all are innovators in their realm. Now, count the iFrames in use. You'd be hard-pressed to find one.
iFrames are like tables--they've been around a long time and like split frame sites from the mid-1990's, many people use them wrong or abuse them altogether. For example, think about iFrames you've noticed on sites...do they have scrolling within a page that scrolls? Did content overflow to the right or down below? Did they just not quite fit? If you noticed it, maybe it wasn't a great idea! Now, consider such factors as SEO, styling, dom manipulation, and standards compliance. Can it be made to work? Sure, but you've probably got better tools in your toolbox.
Todays Iframe imho is content served via Ajax. The only use I can think of where I'd favor an iFrame is limited to pulling in a form for a static html page from another site...and then I'd have to consider all the other circumstances around what I'm trying to do. If you're object oriented, you could simply include the class file and call the appropriate function that you need to do whatever you're trying to do. Maybe you could simply do the call from within the page you're viewing (think simple) And yes, like they said, an include will just execute whatever page your referencing....it's a very common design pattern to use includes for header and footer pages in the absence of a templating engine.
If you'd like more specifics I think we'd all like to help you if you could narrow down the technical challenge you're facing. Good luck.