Including a file on a page - Same page, Different URLs
Posted on 2006-10-30
I have a situation in which I need to include a file on a single page that has 2 different URLs and path depths.
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.