Click to See Complete Forum and Search --> : PHP to replace iframes


TadyB
07-24-2007, 12:41 PM
Is there a way to use a php script to replace an iframe page? I would like to call content into different parts of the page while other parts stay constant. I haven't designed in years and I'm trying to get back into things and learn new ways of developing.

Thanks,
Stacey

dbrandon
07-24-2007, 03:45 PM
Yes, you could use includes to replace the 'sub pages' that would have been in the iframe.

Design your 'main page' (which the content will be added into). All aspects on this page will be constant. Then use

include('path/to/sub/page.html');

to 'pull' the content from another page.

You'd want to assign a variable (probably url) to control the included content.

A simple way to do this would be to use the code

include($_GET['page']);

at some point in your main file (lets say its called index.php). Then, you can control the included page through the url. index.php?page=subpage.html for example. In this case, the content of index.php would be displayed, up until the 'include' then the content of subpage.html would be displayed, followed by the rest of index.php.

You should write a bit of code to check that the requested include is 'allowed'. You wouldnt want people including other pages on your server.

ellisgl
07-30-2007, 03:12 PM
"include($_GET['page']);"....

I would totally not recommend doing that!

Also look up CURL / Snoopy

TadyB
07-30-2007, 03:30 PM
Thanks so much for your suggestions. I will be researching more and trying them out soon.

Beedge
07-31-2007, 03:25 AM
I dont think that iframes and php includes are the same thing at all.

for an include to work the whole page is going to have to be refreshed and served as HTML. Once it gets to the browser it will be a complete HTML page.
Where as to poulate an iframe with content you will only need to refresh that particular frame while the rest of the page remains the same

ellisgl
07-31-2007, 12:49 PM
it all depends on what he's doing.

Eridius
07-31-2007, 01:00 PM
including a file is not the same as an iframe, not even close. I would look into javascript to replace these even tho i would personally find a way of doing tou you are trying to do, whatever that maybe, without doing something like iframes(depending on what your are doing AJAX might work).

ellisgl
07-31-2007, 01:07 PM
Is there a way to use a php script to replace an iframe page?
That was the original question.
The answer would be to CURL it and echo it out. But it all depends on what the iframe page is containing. If it has to deal with $_SESSION or external Links - then this would not be the way to it.

TadyB
07-31-2007, 01:09 PM
This is the site:
http://www.gotechcomputing.com/keils/index.html

The left nav iframe calls a photo gallery into the center iframe according to the link selected. Only the bracelets and earrrings links work as of now.

ellisgl
07-31-2007, 01:56 PM
Are you planing on a shopping cart - or just a web photo gallery?
Oh there are issues with firefox with the left nav.

TadyB
07-31-2007, 02:40 PM
Nope, no shopping cart...just a gallery. I had it working in FireFox earlier and have made a few edits since...I've must have done something it doesn't like. I'm at the point where I'm very willing to scratch everything I have and start over using a better method if you have suggestions on what I should use. I pretty new to php and other scripting methods, but I learn quickly.

Thanks!

ellisgl
08-01-2007, 10:20 AM
I would just head over to hotscripts and look up picture galleries.. There are a ton of them out there.