Forum Moderators: coopster

Message Too Old, No Replies

includes

$server does it need to be defined?

         

russgri

4:51 am on Oct 10, 2003 (gmt 0)

10+ Year Member



I have been using this format for absolute includes

<?php
$title ='Home';
include($_SERVER["DOCUMENT_ROOT"]."/inc/header.php");
include($_SERVER["DOCUMENT_ROOT"]."/inc/logo.php");
include($_SERVER["DOCUMENT_ROOT"]."/inc/topnav.php");
include($_SERVER["DOCUMENT_ROOT"]."/inc/leftnav.php");

This works like a charm but in an application called Whmautopilot, the guru suggested this:

<?php
include $server_inc."/header.php";
include $server_inc."/logo.php";
include $server_inc."/topnav.php";
include $server_inc."/leftnav.php";
?>

But it does not work in my other sites.
So how does it need to be defined to work as an absolute include?

gethan

6:17 am on Oct 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



$server_inc = $_SERVER["DOCUMENT_ROOT"];
etc....

Looks like someones short hand.

HTH

russgri

7:59 pm on Oct 11, 2003 (gmt 0)

10+ Year Member




$server_inc = $_SERVER["DOCUMENT_ROOT"];
etc....
Looks like someones short hand.
HTH

I tried that but no cigar.
I went back to whmaoutpilot's var.php which was not included on header.php.
The guru defined it as:

$server_inc=$server_root."/inc";

That did not works also...although I would like to know why.
Here is what did work...although I would like to apply some shorthand to even this.

$server_inc = $_SERVER["DOCUMENT_ROOT"]."/inc";

So if someone has any other ideas to cut to the chase...please sound off.

jatar_k

12:21 am on Oct 12, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



that makes sense
$sevrerinc is giving a base path for your include files

your included files won't just be sitting in the root, I would imagine they are in a dir somewhere which looks like its named inc.

therefore

your base path for include files is a dir named inc in the site root

$server_inc = $_SERVER["DOCUMENT_ROOT"]."/inc";