Class vB_Template

Description

This class implements variable-registration-based template evaluation, wrapped around the legacy template format. It will be extended in the future to support the new format/syntax without requiring changes to code written with it.

Currently these vars are automatically registered: $vbphrase $show, $bbuserinfo, $session, $vboptions

Located in /includes/class_core.php (line 3738)


	
			
Variable Summary
 static array $pre_registered
 static array $template_queries
 static array $template_usage
 array $registered
 string $template
Method Summary
 static vB_Template create (string $template_name)
 static string fetch_template (string $template_name)
 static string fetch_template_raw (string $template_name)
 static void preRegister (string $template_name, [ $variables = NULL])
 vB_Template __construct ( $template_name)
 string get_template_name ()
 bool is_registered (string $name)
 void quickRegister (mixed $values)
 void register (string $name, mixed $value)
 mixed registered ([string $name = ''])
 string render ([boolean $suppress_html_comments = false])
 mixed unregister (string $name)
Variables
static array $pre_registered = array() (line 3748)

Preregistered variables.

Variables can be preregistered before a template is created and will be imported and reset when the template is created. The array should be in the form array(template_name => array(key => variable))

  • var: mixed
  • access: protected
static array $template_queries = array() (line 3776)

Debug helper to list the templates that were fetched out of the database (not cached properly).

  • access: public
static array $template_usage = array() (line 3769)

Debug helper to count how many times a template was used on a page.

  • access: public
array $registered = array() (line 3762)

Array of registered variables

  • access: protected
string $template = '' (line 3755)

Name of the template to render

  • access: protected
Methods
static create (line 3788)

Factory method to create the template object. Will choose the correct template evaluation method automatically.

Any preregistered variables are also registered and cleared from the preregister cache.

  • return: Template object
  • access: public
static vB_Template create (string $template_name)
  • string $template_name: Name of the template to be evaluated
static fetch_template (line 4055)

Returns a single template from the templatecache or the database

  • access: protected
static string fetch_template (string $template_name)
  • string $template_name: Name of template to be fetched
static fetch_template_raw (line 4034)

Returns a single template from the templatecache or the database and returns the raw contents of it. Note that text will be escaped for eval'ing.

  • access: public
static string fetch_template_raw (string $template_name)
  • string $template_name: Name of template to be fetched
static preRegister (line 3833)

Preregisters variables before template instantiation.

  • access: public
static void preRegister (string $template_name, [ $variables = NULL])
  • string $template_name:
    • The name of the template to register for
  • array $variables:
    • The variables to register
Constructor __construct (line 3805)

Protected constructor. Use the factory method.

  • access: protected
vB_Template __construct ( $template_name)
  • $template_name
get_template_name (line 3822)

Returns the name of the template that will be rendered.

  • access: public
string get_template_name ()
is_registered (line 3915)

Determines if a named variable is registered

  • access: public
bool is_registered (string $name)
  • string $name: Name of variable to check
quickRegister (line 3874)

Registers an array of variables with the template.

  • access: public
void quickRegister (mixed $values)
  • mixed $values: Assoc array of name => value to be registered
register (line 3852)

Register a variable with the template.

  • access: public
void register (string $name, mixed $value)
  • string $name: Name of the variable to be registered
  • mixed $value: Value to be registered. This may be a scalar or an array.
registered (line 3928)

Return the value of a registered variable or all registered values

  • return: If a name is specified, the value of the variable or null if it doesn't exist. If not specified, an array of all variables.
  • access: public
mixed registered ([string $name = ''])
  • string $name: The name of the variable to get the value for.
register_page_templates (line 3944)

Automatically register the page-level templates footer, header, and headinclude based on their global values.

  • access: public
void register_page_templates ()
render (line 3959)

Renders the template.

  • return: Rendered version of the template
  • access: public
string render ([boolean $suppress_html_comments = false])
  • boolean $suppress_html_comments: Whether to suppress the HTML comment surrounding option (for JS, etc)
unregister (line 3894)

Unregisters a previously registered variable.

  • return: Null if the variable wasn't registered, otherwise the value of the variable
  • access: public
mixed unregister (string $name)
  • string $name: Name of variable to be unregistered

Documentation generated on Tue, 26 Jan 2010 15:15:06 -0600 by phpDocumentor 1.4.3