Gumbo_Template



Template Class

The Template Class is responsible for saving global Template values and loading the appropriate Template Engine. The program can easily use the global settings to easily pull the appropriate Engine without defining the specific engine. For example, if the application uses one type of Template Engine throughout, this class will automatically load the defined Engine. All properties are static to preserve their state.

 $tpl = new Gumbo_Template ();
 $tpl->factory ()->engineMethod ();

Author(s): Michael Luster <mluster79@yahoo.com>
License:New BSD License
Copyright:Copyright (c) 2007, iBayou, Michael Luster
Link:http://sourceforge.net/projects/phpgumbo
Version:0.0.1

Implements interfaces:

Class Variables

static string $_global_dir_cache [line 60]
static string $_global_dir_compile [line 58]
static string $_global_dir_config [line 62]
static string $_global_dir_tpl [line 56]
static string $_global_engine [line 51]
static string $_global_left_del [line 65]
static string $_global_right_del [line 67]
static array $_global_vars = array () [line 53]

Class Methods

public static void assign ( string|array $key, [mixed $val] ) [line 116]

Assigns a global template variable

All global template variable references will be prepended with "global_*" string. This will separate the global variables from local template variables.

Parameter(s):

  • (string|array) $key :: template reference
  • (mixed) $val :: template value
  • throws:  Gumbo_Exception
  • precondition:  must be a primitive type
Implementation of:
Gumbo_Interface_Template::assign()

[ Top ]
public static string getDirCache ( ) [line 387]

Returns the global Template cache directory

Implementation of:
Gumbo_Interface_Template::getDirCache()

[ Top ]
public static string getDirCompile ( ) [line 379]

Returns the global Template compile directory

Implementation of:
Gumbo_Interface_Template::getDirCompile()

[ Top ]
public static string getDirConfig ( ) [line 395]

Returns the global Template config directory

Implementation of:
Gumbo_Interface_Template::getDirConfig()

[ Top ]
public static string getDirTpl ( ) [line 371]

Returns the global Template directory

Implementation of:
Gumbo_Interface_Template::getDirTpl()

[ Top ]
public static string getEngine ( ) [line 331]

Returns the global template engine

Implementation of:
Gumbo_Interface_Template::getEngine()

[ Top ]
public static string getLeftDelimeter ( ) [line 403]

Returns the global left delimeter

Implementation of:
Gumbo_Interface_Template::getLeftDelimeter()

[ Top ]
public static string getRightDelimeter ( ) [line 411]

Returns the global right delimeter

Implementation of:
Gumbo_Interface_Template::getRightDelimeter()

[ Top ]
public static mixed getVar ( string $key ) [line 341]

Returns a global template variable value

Parameter(s):

  • (string) $key :: variable reference
  • throws:  Gumbo_Exception
Implementation of:
Gumbo_Interface_Template::getVar()

[ Top ]
public static array getVars ( ) [line 363]

Returns all the global template variables

Implementation of:
Gumbo_Interface_Template::getVars()

[ Top ]
public static bool isEngine ( string $engine ) [line 424]

Returns if the Template Engine exists

Parameter(s):

  • (string) $engine
Implementation of:
Gumbo_Interface_Template::isEngine()

[ Top ]
public static void setDirCache ( string $loc ) [line 246]

Sets the global template file cache directory

Parameter(s):

  • (string) $loc
  • throws:  Gumbo_Exception
  • precondition:  is_dir ($loc)
Implementation of:
Gumbo_Interface_Template::setDirCache()

[ Top ]
public static void setDirCompile ( string $loc ) [line 223]

Sets the global template file compile directory

Parameter(s):

  • (string) $loc
  • throws:  Gumbo_Exception
  • precondition:  is_dir ($loc)
Implementation of:
Gumbo_Interface_Template::setDirCompile()

[ Top ]
public static void setDirConfig ( string $loc ) [line 269]

Sets the global template file config directory

Parameter(s):

  • (string) $loc
  • throws:  Gumbo_Exception
  • precondition:  is_dir ($loc)
Implementation of:
Gumbo_Interface_Template::setDirConfig()

[ Top ]
public static void setDirTpl ( string $loc ) [line 200]

Sets the global template file directory

Parameter(s):

  • (string) $loc
  • throws:  Gumbo_Exception
  • precondition:  is_dir ($loc)
Implementation of:
Gumbo_Interface_Template::setDirTpl()

[ Top ]
public static void setEngine ( string $engine ) [line 176]

Sets the global template engine to use

Parameter(s):

  • (string) $engine
  • throws:  Gumbo_Exception
Implementation of:
Gumbo_Interface_Template::setEngine()

[ Top ]
public static void setLeftDelimeter ( string $val ) [line 291]

Sets the global left delimeter value

Parameter(s):

  • (string) $val
  • throws:  Gumbo_Exception
Implementation of:
Gumbo_Interface_Template::setLeftDelimeter()

[ Top ]
public static void setRightDelimeter ( string $val ) [line 310]

Sets the global right delimeter value

Parameter(s):

  • (string) $val
  • throws:  Gumbo_Exception
Implementation of:
Gumbo_Interface_Template::setRightDelimeter()

[ Top ]
public static void unassign ( string $key ) [line 151]

Removes the global variable assignment

Parameter(s):

  • (string) $key :: template variable reference
  • throws:  Gumbo_Exception
Implementation of:
Gumbo_Interface_Template::unassign()

[ Top ]
public Gumbo_Interface_Template_Engine factory ( [string $name], [string $args] ) [line 80]

Creates a new Template_Engine object

Parameter(s):

  • (string) $name :: template file name (optional)
  • (string) $args :: name of the engine

[ Top ]