By m2jalali on
I want to access global variable of drupal (like user variable in
drupal) into another php files
I Create a new module for example test module.
my test module have 3 files . test.info , test.module , main.php
I want to use global variable of drupal into main.php as following code
global $user;
please guide me how can i access this drupal variable in my page?
thanks
Comments
Declare your variable with global keyword
Hi,
So simple just declare your variable with global keyword in your php file and then initiate your global variable.
Now your global variable available in anywhere in your project until unless you are disable the module.
For example...
But More powerful drupal way is,
Note: your main.php should be included in drupal running way....
good luck...,
global variable
i mean global variable of drupal not simple global variable in a php page
hi, If you want to use
hi,
If you want to use drupal's or any other global variable in your php file (main.php) i need information about how you include your file (main.php) in any custom/contributed module(test.module)... Need info on these to give respective solution...
thanks,