Problem with TT variables

Jon Wilmoth JWilmoth at
Wed Jun 25 18:04:02 UTC 2003

I'm working on a patch for and am not having any
success implementing the variable names the way Gerv has suggested
(required?).  This bug basically tries to turn a few Bugzilla terms into
variables that can be customized.  The approach I took was to create a
hash of terms in a new file global/variables.none.tmpl and reference
them in the various templates that use those terms.  Sounds simple
enough, but getting the variables to be declared and referenced in one
way  is proving very difficult for a TT newbie.  There are basically
three code usage scenarios in which the template variables need to work:

1) Simple in-template usage (example from
	(Leave all boxes unchecked to make this a public [%
global.terms.bug %].)
2) Process usage (example from
	[% PROCESS global/header.html.tmpl
  		title = "Enter $global.terms.Bug"
		h2 = "This page lets you enter a new $global.terms.bug
into $global.terms.Bugzilla."
3) In-template hash definition (example from
	[% field_descs = { "[Bug creation]"       => "[$global.terms.Bug

The only code I've been able to get working under all three cases is:
1) Including the variable file - [% INCLUDE global/variables.none.tmpl
2) Defining the hash in variables.none.tmpl using the global namespace
keyword like so:
[% global.terms = {
	bug = "bug",
	Bug = "Bug",
	abug = "a bug",
	Abug = "A bug",
	bugs = "bugs",
	Bugs = "Bugs",
	zeroSearchResults = "Zarro Boogs found",
	bit = "bit",
	bits = "bits",
	Bugzilla = "Bugzilla"
3) Referencing the termanology variables using [% global.terms.bug %]
(scenario 1) or $ global.terms.bug (scenario 2 & 3).

Changing the way the variables are brought into a template to  - [%
PROCESS global/variables.none.tmpl %] instead of INCLUDE allows the
variables has to be declared and referenced without the global prefix in
usage scenario #1, but they are not resolved under usage scenarios #2 &

I realize this is somewhat against the normal usage of includes as
normally you pass variables *TO* an include/process page instead of
attempting to use variables defined *BY* an include, but if anyone knows
TT well enough to give me some direction, I'd appreciate it.

More information about the developers mailing list