Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

3. The Template Language > Template Variables

Template Variables

The Template Toolkit’s simple-to-access variables are one of its strengths. In this section, we describe the syntax and semantics of variables—what names are allowed, the different types of data that can be stored in a variable, the predefined Template Toolkit variables, and so on.

What’s in a Name?

Variable names can contain alphanumeric characters or underscores. They can be lowercase, uppercase, or mixed case, although the usual convention is to use lowercase to avoid confusion with uppercase directives. The case is significant, however, so foo, Foo, and FOO are all different variables. Here are some examples of valid variable names:

foo
foo123
foo_bar
foo_bar_123  
FooBar123    
Foo_Bar_123

  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint