Gumbo_Template_Special



Special Abstract Template Class

This is a special element of Templates. It will typically define a part of the program that commonly appears on every View. The best example is a Header and Footer. There can only be one Special Template element. All Special Template classes should implement Singleton. This will make the object accessible everywhere.

For example, if the Header defines a navigation menu that changes with the different areas of an application. Each area has a special menu it defines. The Special_Header would load the main menu by default, allowing the application to change the menu as necessary. This is a simple example (if the program uses menus). The programmer could simply define a Special_Menu class. It depends on the application needs.

The Special elements could be processed when outputting the main Template contents, or by simply assigning the element to a Template_Engine and defining it's location inside the Template file. It's really at the programmer's discretion.

ELEMENTS These are special objects (Gumbo_Template_Engine) that are assigned to the Special Template. By assigning an Element, the program can manipulate the object by retrieving the element. This will separate standard Template variable assignment from element assignment. It ensures that the returning element is a Gumbo_Template_Engine.

BASIC FILE (optional) This file is loaded when the Special Template object is inactive. If no file is defined, the output should be blank. The basic file is a cut-down version or simplified display. For example, the main Header is used for the primary website, but the basic Header is used to show a printable view on screen. (This should be handled with CSS, but it's a quick example).

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:

Child classes:

Class Variables

bool $_active =  true [line 81]
Gumbo_Interface_Output[] $_elements = array () [line 73]
Gumbo_Template_Engine $_engine [line 70]
string $_file [line 76]
string $_file_basic [line 78]

Class Methods

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

Assigns a template variable with a value (wrapper to Gumbo_Template_Engine::assign())

Parameter(s):

  • (string|array) $key :: template file reference
  • (mixed) $val

[ Top ]
public void assignElement ( string $key, Gumbo_Template_Engine $obj ) [line 108]

Assigns an Element to the template

Parameter(s):

  • throws:  Gumbo_Exception

[ Top ]
public void display ( ) [line 89]

Displays the formatted template file


[ Top ]
public Gumbo_Template_Engine getElement ( string $key ) [line 226]

Returns the Template_Engine element

Parameter(s):

  • (string) $key
  • throws:  Gumbo_Exception

[ Top ]
public Gumbo_Interface_Template_Engine[] getElements ( ) [line 248]

Returns the list of elements


[ Top ]
protected Gumbo_Template_Engine getEngine ( ) [line 200]

Returns the Special Template's Template_Engine


[ Top ]
public string getFile ( ) [line 208]

Returns the standard file


[ Top ]
public string getFileBasic ( ) [line 216]

Returns the basic file


[ Top ]
public bool isActive ( ) [line 256]

Returns if the feature is active


[ Top ]
protected void setEngine ( Gumbo_Template_Engine $engine ) [line 145]

Sets the Template_Engine object

Parameter(s):


[ Top ]
public void setFile ( string $file ) [line 154]

Sets the standard file (full path)

Parameter(s):

  • (string) $file
  • throws:  Gumbo_Exception

[ Top ]
public void setFileBasic ( string|null $file ) [line 176]

Sets the basic file (full path)

Parameter(s):

  • (string|null) $file
  • throws:  Gumbo_Exception

[ Top ]
public void turnOff ( ) [line 134]

Turns the class off

  • postcondition:  !isActive()

[ Top ]
public void turnOn ( ) [line 126]

Turns the class on

  • postcondition:  isActive()

[ Top ]