note 48013 added to function.include

From: Date: Thu, 09 Dec 2004 03:22:12 +0000
Subject: note 48013 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-81559@lists.php.net to get a copy of this message
I've noticed that if you're trying to include a page that is going to use data available on the page you're including from, you need to make it a relative link for it to be able to understand the values. For instance... <?php //includefile.php echo $city->name; ?> <?php //other file $city = new City(); $city->name = "London"; //understands variable include 'includefile.php'; //cannot read variable include 'http://'.$_SERVER['HTTP_HOST'].dirname( $_SERVER['PHP_SELF'] ).'/includefile.php'; ?> This drove had me hanging for a while. Hope it helps someone out. ~RJ ---- Manual Page -- http://www.php.net/manual/en/function.include.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+48013 Delete -- http://master.php.net/manage/user-notes.php?action=delete+48013&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48013&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48013&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48013&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48013&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48013&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+48013&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#81559) next »