bertieboy_93 Posted August 13, 2006 Share Posted August 13, 2006 I have browsed the internet and have learnt that you cannot use PHP includes with site relative linking. I was wondering if there was any alternative way where I could use PHP to include a file using a site relative link to define the include file. As far as I know there isn't, and a google search hasn't shown an alternative. I can't use an SHTML file for the include as I have important PHP scripts on the page. Does anyone know of any sort of alternative or solution?Many thanks to anyone who can help. Quote Link to comment Share on other sites More sharing options...
onlyican Posted August 13, 2006 Share Posted August 13, 2006 If by relative linking u mean not the full url, yes you caninclude("file.php"); Quote Link to comment Share on other sites More sharing options...
bertieboy_93 Posted August 13, 2006 Author Share Posted August 13, 2006 No, I don't mean not the full URL. I mean site relative as in: <? include("[color=red][b]/[/b][/color]page.php"); ?> Quote Link to comment Share on other sites More sharing options...
onlyican Posted August 13, 2006 Share Posted August 13, 2006 ahhyou can use docroot<?phpinclude($_SERVER['DOCUMENT_ROOT']."/file.php"); ?> Quote Link to comment Share on other sites More sharing options...
bertieboy_93 Posted August 13, 2006 Author Share Posted August 13, 2006 Thanks for the solution, it worked great! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.