Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Problem with variables from include()ed or require()d files

 
Post new topic   Reply to topic    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
dhomsher
Smarty n00b


Joined: 01 Sep 2004
Posts: 1

PostPosted: Wed Sep 01, 2004 1:05 pm    Post subject: Problem with variables from include()ed or require()d files Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Plugins All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP