PDA

View Full Version : Includes w/o frames



blazedj
05-27-2006, 03:33 PM
Hello!
Maybe someone can help me?
I wonder if it's possible to include any page (not just txt/xml but also html/php) without frames or iframes while leaving all links relative to the original site (to display the site correctly). The page should be loaded by client, not server (fsockopen etc). Can I do it with AJAX and PHP? :confused:
Thanks in advance!

shachi
05-27-2006, 04:44 PM
yea surely u can

if you want to include html or txt or php pages in a .php file then do this:



include_once("file.ext");


and if you want it to be in a html page then here's the answer:

http://search.freefind.com/find.html?id=6299074&pageid=r&mode=ALL&n=0&query=ajax+include
uses ajax.

blazedj
05-27-2006, 05:16 PM
yea surely u can

if you want to include html or txt or php pages in a .php file then do this:



include_once("file.ext");


and if you want it to be in a html page then here's the answer:

http://search.freefind.com/find.html?id=6299074&pageid=r&mode=ALL&n=0&query=ajax+include
uses ajax.
include_once changes all relative links to http://my_site/file so images don't load and site looks weird :(

I've tried ajax include script already but the page appears as blank for some reason. Does it work with php pages for someone? :confused:

shachi
05-27-2006, 06:05 PM
Did you upload it to a webserver?? AJAX is meant to send and recieve data only from and to a webserver not your common folder. upload it in something like /var/www/

blazedj
05-27-2006, 06:39 PM
Did you upload it to a webserver?? AJAX is meant to send and recieve data only from and to a webserver not your common folder. upload it in something like /var/www/
no, I need to include external pages. Is it possible?

shachi
05-27-2006, 06:41 PM
Huh?? External pages?? what do you mean pages from remote server?? like google.com and bla bla bla??

blazedj
05-27-2006, 07:18 PM
Huh?? External pages?? what do you mean pages from remote server?? like google.com and bla bla bla??
yep, that's it

shachi
05-27-2006, 07:25 PM
If that's so then I am afraid you must use iframes. May be that's possible but I am not that sure. By the way why do you want to use include instead of iframe?? May be I(or someone other) can think of something after knowing why you want it for.

blazedj
05-27-2006, 07:43 PM
If that's so then I am afraid you must use iframes. May be that's possible but I am not that sure. By the way why do you want to use include instead of iframe?? May be I(or someone other) can think of something after knowing why you want it for.
well, I want to make some money with paid-to-promote sites but they don't allow promotion in frames or rotators. that's why i need to include the pages so my page will look solid like i promote ptp directly. why i need this? my page gets 30k+ hits daily ;)

blazedj
05-28-2006, 07:07 AM
I've decided that I will use header() instead. Is there any way to load a floating layer after the page loads thru php header()?

djr33
05-28-2006, 07:19 AM
include() will do what you want.
include_once isn't really better... it just makes it only include once... if you "include_once" the same page twice, it'll only show up once...
just use include... unless there's some reason.

anyway...

you will need to rewrite the links in the external page... so that the relative links are relative to the old page.
this is fairly complex, but basically just finding the URLs and adding the external directory to them... not too bad.
also note that images will work like links... so change those too.

if you were to google phproxy, you could use that to help you get an idea of how to change links... it's a proxy thing that makes the links relative to your own site... so you could use some of that code to help you, probably.

blazedj
05-28-2006, 08:31 AM
include() will do what you want.
include_once isn't really better... it just makes it only include once... if you "include_once" the same page twice, it'll only show up once...
just use include... unless there's some reason.

anyway...

you will need to rewrite the links in the external page... so that the relative links are relative to the old page.
this is fairly complex, but basically just finding the URLs and adding the external directory to them... not too bad.
also note that images will work like links... so change those too.

if you were to google phproxy, you could use that to help you get an idea of how to change links... it's a proxy thing that makes the links relative to your own site... so you could use some of that code to help you, probably.

phproxy is a powerful tool but it uses the server to download pages and then just prints content. this is not acceptable in my case because the ip will be same all the time :(
i don't think it's possible to use include() and str_replace() together