Link to home
Start Free TrialLog in
Avatar of carlenevs
carlenevs

asked on

Including a file on a page - Same page, Different URLs

Hello Everybody!

I have a situation in which I need to include a file on a single page that has 2 different URLs and path depths.

For example:
Include File: http://www.mysite.com/include/include.inc
URL 1 = http://www.mysite.com/mypage/index.php
URL 2 = http://mypage.mysite.com/index.php

I know I can include a file absolutely by using $_SERVER['DOCUMENT_ROOT'], but that does not work in the URL 2 situation (as the DOCUMENT_ROOT includes the "mypage" directory in its output, essentially then looking for the file in root/mypage/include/include.inc instead of root/include/include.inc).

Is there any straightforward way to overcome this? This is within a larger system using templates, so I don't have a lot of leeway in my programming.

Thanks!
Carlene
ASKER CERTIFIED SOLUTION
Avatar of CraigHarris
CraigHarris

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of www-i-p-mu
www-i-p-mu

me i'll put like this

include('http://www.mysite.com/mypage/index.php');


include('http://mypage.mysite.com/index.php');


Good luck!!
Wait.
So, why are the paths not relative?
Both of those URLS point to the same folder no>?