$::vars hash

Gervase Markham gerv at mozilla.org
Wed Sep 18 22:33:28 UTC 2002


As you will know, the current templatisation system uses a $::vars 
global variable to pass variables to the template. What you may not know 
is that some variables get stashed in it for you, meaning you don't need 
to stash them again. Here's the current list:

There are the following functions:
$vars->{'Param'} - for retrieving global parameters
$vars->{'lsearch'} - Generic search function to find items in arrays
$vars->{'UserInGroup'} - for seeing if a user is in a group
$vars->{'time2str'} - for creating date strings. For l10n reasons, 
please use.

And the following strings:
$vars->{'user_agent'} - the user's user-agent; useful for the occasional 
fork
$vars->{'VERSION'} - the Bugzilla version

There's a $vars->{'user'} object:
     $user{'login'} - the user's login name (email address)
     $user{'userid'} - the user's numeric userid

     Other info from user record:
     $user{'showmybugslink'}
     $user{'realname'} - real name
     $user{'groupset'}
     $user{'blessgroupset'}

     $user{'queries'} is a list of hashes of info about the user's saved 
queries.
     $user{'groups'} is a hash, keyed by name, of group bits.

These items are accessed as $vars->{'user'}{'realname'}, or [% 
user.realname %] in the templates.

If you have other information to pass into a template which relates to 
the user, please store it in the user object.

Gerv




More information about the developers mailing list