Jump to content

Archived

This topic is now archived and is closed to further replies.

bertieboy_93

PHP include site relative

Recommended Posts

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.

Share this post


Link to post
Share on other sites
If by relative linking u mean not the full url, yes you can

include("file.php");

Share this post


Link to post
Share on other sites
ahh
you can use docroot

<?php
include($_SERVER['DOCUMENT_ROOT']."/file.php");
?>

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.