Table of Contents

 

7.3 Global Variables

This chapter describes the Turbine Variables that have a special meaning inside the Turbine engine.

 

 

 

Media and System Global Variables

Turbine includes two automatically defined families of variables that contain contextual information about the media being generated, as well as a number of system settings and defaults - the Media and System variable families:

Media:

Variable Description Example
{Media.Width} The output native Width in pixels 550
{Media.Height} The output native Height in pixels 400
{Media.FrameRate} The number of frames per second 12
{Media.Color} The native background color to be output #FFFFFF
{Media.NumFrames} Total number of frames 20
{Media.Flash.Version} The numeric version to use when generating Flash 6
{Media.Debug} A boolean value that specifies whether the Turbine Window will be included on the generated media. On Flash, also defines if a native debug tag will be emitted, allowing the movie to be debugged on the browser/Flash editor Yes
{Media.Protect} Whether the output media will be protected - for example when generating Flash this means the "protect from import" flag No
{Media.Compress} If non-zero, specifies the level of output compression, from 1 to 9, with 9 being the best compression. If 0 or "No", no compression is applied. On Flash, applies Flash 6+ compression to the generated movie 9
{Media.Script} The complete URL path to the executed PHP script /turbine/script.php
{Media.Query} The QUERY_STRING used to call the script person=Mathilda
{Media.Location} The path and query string used to request this script - very useful for self-referencing /turbine/script.php?
person=Mathilda
{Movie.Self} The path and query string used to request this script, for use with the GenerateHTMLFirst command, for self-referencing /turbine/script.php?
person=Mathilda&
_media


Media.PDF:

When generating Adobe PDF documents, Turbine also uses these variables:

Variable Description Example
{Media.PDF.Version} The numeric PDF version to use when generating PDF.
For Acrobat PDF viewer 6, use 5, for Acrobat PDF viewer 5 use 4 and so on. Default is version 2, requiring Acrobat PDF viewer 3.
2
{Media.PDF.Title} The title of the PDF document. Visible in the document properties My Title
{Media.PDF.Subject} The subject of the PDF document. Visible in the document properties My Subject
{Media.PDF.Author} The author of the PDF document. Visible in the document properties My Name
{Media.PDF.UserPassword} When defined causes the PDF document to be encrypted. The user must provide this password in order to open it MyPassword
{Media.PDF.OwnerPassword} When defined causes the PDF document contents to be encrypted MyPassword
{Media.PDF.Permissions}

PDF document permissions, a combination of:
noPrinting - the PDF user can't print the document
noChanging - the PDF user can't change the document
noContentCopying - the user can't copy the document contents
noCommenting - the user can't comment the document.

This variable only has any effect if the PDF document is encrypted. To encrypt a PDF document set {Media.PDF.UserPassword} or {Media.PDF.OwnerPassword}

noPrinting


System:

Default values for System variables are read from the system.settings file on the Turbine installation directory - this file is read during application load time.
The following System variables are defined:

Variable Description Example
{System.Log} The log level, a combination of:
errors - log errors
warnings - log warnings
info - log information messages
errors, warnings
{System.LogTo} Where to log into, a combination of:
media - log into the Turbine Window
file - log to the turbine.log file
media
{System.Debug} The default value to use in the {Media.Debug}, if not specified by user No
{System.Protect} The default value to use in the {Media.Protect} variable, if not specified No
{System.Compress} The default value to use in the {Media.Compress} variable, if not specified No
{System.FontName} The default font name to use when not specified in a <Text> tag Arial
{System.FontStyle} The default font style to use when not specified in a <Text> tag bold, italic
{System.FontSize} The default font size to use when not specified in a <Text> tag. Must be expressed in a value where the size in pixels is multiplied by 20 - for example a 20 pixel font size should be specified here as
20 * 20 = 400
400
{System.FontColor} The default text color to use when not specified in a <Text> tag #000000
{System.FontMapSans}
{System.FontMapSerif}
{System.FontMapTypewriter}

The font names to be used (mapped) when a font is not available and needs to be mapped.
Far East users might prefer to use other font faces - for example MS Gothic or MS Mincho or Arial Unicode MS

Arial
{System.ImageEncodeFlags} Default encoding for images, when not specified in the<image> tag. Can be 0, to use the image's native encoding or one of:
1 - JPEG encoding
2 - ZLIB encoding,
3 - use one of JPEG or ZLIB that produces better compression
3
{System.ImageEncodeQuality} Default encoding quality, in percentage, to use when not specified on the <Image> tag. Similar to common JPEG quality /compression settings 85
{System.ImageSmooth} Default smoothening to use if not specified on the <Image> tag. Use 0 for no smoothening 0
{System.ImageResampleMethod} The image resizing method to use if not specified on an <Image> tag. One of:
0 - raw pixel resize
1 - average pixel resize
2 - bilinear resize
3 - bicubic resize
2
{System.MMLTagRequired} A boolean value that specifies whether MML tags used in Flash .swf templates must have be enclosed in <mml> ... </mml> tags.
Should be used if there's the danger of unintended MML tags used in Flash templates being parsed by Turbine.
No
{System.MMLWarnUnknownTags} Boolean value that specifies whether unknown MML tags raise warnings. Good during development to find locate misspellings in MML tags Yes
{System.AutoLayout} The default mode used on the AutoLayout funcionality - one of horizontal, vertical or off vertical

 
 

Special Variables

Turbine automatically defines a number of special, utility variables for information like random numbers, current time and date. The following special variables can be used:

Time:

Variable Description Formatting
{Time.Year} The current year yyyy (ex. 1999)
{Time.Year2} The current year yy (ex. 99)
{TimeMonth} Current month 1 - 12 m or mm (ex. 2)
{Time.Month0} Current month 01 - 12 always mm, left-pads with 0 (ex. 02)
{Time.MonthName} January, February ... -
{Time.WeekDay} Day of the week, between 1 and 7 d
{Time.WeekDayName} Sunday, Monday... -
{Time.Day} Day of the month 1 - 31 d or dd (ex. 4)
{Time.Day0} Day of the month 01 - 31 DD left-pads with 0 (ex. 04)
{Time.Hour} Hour 0 - 23 h or hh (ex. 8)
{Time.Hour0} Hour 00-23 hh left-pads with 0 (ex. 08)
{Time.HourAmPm} Hour 00 - 11 hh left-pads with 0 (ex. 08)
{Time.AmPm} Am or Pm, depending on actual time tt (ex. Am)
{Time.Minute} Current minute 0 - 59 m or mm (ex. 7)
{Time.Minute0} Current minute 00 - 59 always mm left-pads with 0 (ex. 07)
{Time.Second} Current second 0 - 59 s or ss (ex. 57)
{Time.Second0} Current second 00 - 59 Ss left-pads with 0 (ex. 57)
{Time.Canonic} A date in the format:
YYYYMMDDHHMMSS
-

 
 
Random Values:

Variable Description Formatting
{Random.NewN} Generates a new random number each time it's used. The number has N digits up to a maximum of 6 digits.  N digits
{Random.SameN} Generates a random number that's unique across the whole movie (but different for each movie). The number has N digits up to a maximum of 6 digits. N digits
{Random.NewN[min..max]} Generates a new random number, between min and max. The number is formatted to N digits (up to a maximum of 6 digits).  N digits
{Random.SameN[min..max]} Generates a random number that's unique across the whole movie (but different for each movie), between min and max. The number is formatted to N digits (up to a maximum of 6 digits).  N digits
{Random.NewColor} and
{Random.NewColorAlpha}
Generates a new random color in HTML style with the format RRGGBB or AARRGGBB
-
{Random.SameColor} and
{Random.SameColorAlpha}

Generates a random color in HTML style with the format RRGGBB or AARRGGBB
This color is unique across the whole movie (but different for each movie).

-

 

Table of Contents

 
Flash and Macromedia Flash are trademarks of Macromedia, Inc.