|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
dhomsher Smarty n00b
Joined: 01 Sep 2004 Posts: 1
|
Posted: Wed Sep 01, 2004 1:05 pm Post subject: Problem with variables from include()ed or require()d files |
|
|
I seem to be having a problem with setting variables from files included from a plugin.
For example:
I require() a file that sets up several variables (the file is used throughout the project):
require_once "/config/sitewide.php";
this sets a $basePath variable and an $adminPath that are used to determine where class files are located. Throughout the project I can then pull in the class like so:
require_once "$basePath$adminPath/modules/mymodule.class.php";
Unfortunately, when I try this same method from within a plugin (or even from a {php_include} directive the $basePath and $adminPath varibles are not set, although they appear in $GLOBALS.
I can include the file in the following way:
require_once "{$GLOBALS['basePath']}{$GLOBALS['adminPath']}/modules/mymodule.class.php";
but the class file uses the same methods to include other classes. The class ends up having the same problem with variables from an included file not being set.
Is this a limitation? My ignorance of the way things work? Any help would be greatly appreciated.
-Dave |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|