Source for file Special.class.php
Documentation is available at Special.class.php
* Gumbo Library Framework
* This library is being released under the terms of the New BSD License. A
* copy of the license is packaged with the software (LICENSE.txt). If no
* copy is found, a copy of the license template can be found at:
* http://www.opensource.org/licenses/bsd-license.php
* @copyright Copyright (c) 2007, iBayou, Michael Luster
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @author Michael Luster <mluster79@yahoo.com>
* @link http://sourceforge.net/projects/phpgumbo
* 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
* 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.
* 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.
* 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).
* @copyright Copyright (c) 2007, iBayou, Michael Luster
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @author Michael Luster <mluster79@yahoo.com>
* @link http://sourceforge.net/projects/phpgumbo
* @desc Special Abstract Template Class
gumbo_load ("Interface_Output");
gumbo_load ("Template_Engine");
/** @var Gumbo_Template_Engine $_engine */
/** @var Gumbo_Interface_Output[] $_elements special Output elements */
/** @var string $_file standard file */
/** @var string $_file_basic basic file */
/** @var bool $_active if standard mode is active */
* Displays the formatted template file
* Assigns a template variable with a value (wrapper to Gumbo_Template_Engine::assign())
* @param string|array$key template file reference
public function assign ($key, $val=
null) {
* Assigns an Element to the template
* @param Gumbo_Template_Engine $obj
* @throws Gumbo_Exception
public function assignElement ($key, Gumbo_Template_Engine $obj) {
$e->setFunction (__METHOD__
);
* @postcondition isActive()
* @postcondition !isActive()
* Sets the Template_Engine object
* @param Gumbo_Template_Engine $engine
* Sets the standard file (full path)
* @throws Gumbo_Exception
$e->setFunction (__METHOD__
);
* Sets the basic file (full path)
* @param string|null$file
* @throws Gumbo_Exception
$e->setFunction (__METHOD__
);
* Returns the Special Template's Template_Engine
* @return Gumbo_Template_Engine
* Returns the standard file
* Returns the Template_Engine element
* @return Gumbo_Template_Engine
* @throws Gumbo_Exception
$e->setFunction (__METHOD__
);
* Returns the list of elements
* @return Gumbo_Interface_Template_Engine[]
* Returns if the feature is active