Archive for Downsizer For an ethical approach to consumption
 


       Downsizer Forum Index -> IT Matters
Northern_Lad

Page referencing in php

'ow do.

I'm changing a page that used to be in framed asp, but is now required in php.
Due to various reasons, the file has to be included as it's held at a remote site.

My page will still be in asp, but instead of being included into asp/html it's going to be included into php.
The problem I have is that when the file is included it picks up the root of the hosting pages, not the root of their location as they do at the moment.

Anyone got any experience in this?
jema

Re: Page referencing in php

Northern_Lad wrote:
'ow do.

I'm changing a page that used to be in framed asp, but is now required in php.
Due to various reasons, the file has to be included as it's held at a remote site.

My page will still be in asp, but instead of being included into asp/html it's going to be included into php.
The problem I have is that when the file is included it picks up the root of the hosting pages, not the root of their location as they do at the moment.

Anyone got any experience in this?


I know php inside and out, but I am afraid I don't quite grasp the question Embarassed
Northern_Lad

Re: Page referencing in php

jema wrote:
I know php inside and out, but I am afraid I don't quite grasp the question Embarassed


OK.

Client 1:
They have a database and host a set of pages.

Client 2:
Hosts thier own site, some of which #include those hosted by client 1.


Currently:
Client 2's site is in asp, with the #include pages in their own frame: dynamic links on the #include pages work as //client1/page.asp.

Desired:
Client 2's site will be in php - no frames. When the old #include pages are linked in the pages now show as //client2/page.asp.

Does that clarify it a bit?
Jb

Just a guess but I suspect you would need to change references in client 1 from $_SERVER['PHP_SELF'] to $_SERVER['HTTP_REFERER'] (or something like that it depends how the ASP and client 2 implement their #include thingie)
Jb

Addendum - or client2 could have to wrap the #include text in a str_replace()

(Caveat - I'm not a PHP expert I just happen to be looking at something similar right now)
jema

when you include a php page it will be executed by the server that it resides on. That is a given. Is this where the confusion arises? the php page on client1 cannot be allowed to see files on client2.
Northern_Lad

jema wrote:
when you include a php page it will be executed by the server that it resides on. That is a given. Is this where the confusion arises? the php page on client1 cannot be allowed to see files on client2.


Wrong way round: the included file (from client 1) will be asp, and included into clent 2's php pages.
Jb

So something like ... ?

$remotesite = 'http://www.example.com';
ob_start();
include $remotesite.'/remote.asp';
$contents = ob_get_contents();
ob_end_clean();
$contents = str_replace($remotesite, $_SERVER['PHP_SELF'], $contents);
return $contents;
Northern_Lad

Erm, not sure; I'm not doing the php pages.

Could it be the php call that's the problem, not the asp? The asp reference is "../path"
       Downsizer Forum Index -> IT Matters
Page 1 of 1
Home Home Home Home Home