Source for file gltemplate.php
Documentation is available at gltemplate.php
* GloryLands Inteface system
* GloryLands, a Web-Based, Massive Multiplayer Online RPG/Strategy Game
* Copyright (C) 2008-09 John Haralampidis <jïhnys2[at]gmail.cïm>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* For any help/suggestions or troubleshooting you can see the
* project community website at <http://www.glorylands.gr>
* @license GNU/GPLv3 GNU General Public License version 3
* @author John Haralampidis <jïhnys2[at]gmail.cïm>
* @copyright Copyright (C) 2007-2009, John Haralampidis
* GloryLands PHP Template Engine
* This template extends the Dataset structure in order to provide
* simple variable access, and uses template optimizer to convert
* short-hand PHP tags to fully compatible PHP code.
* Register a template extension
* @param string $category Target category
* @param object $function The function to call for this category
if (!self::$extensions) self::$extensions = array();
self::$extensions[] = array(
* Call a template category
* @param string $category Target category
public static function call_extension($category, $a= false,$b= false,$c= false,$d= false,$e= false,$f= false,$g= false,$h= false) {
if (!isset (self::$extensions[$event])) {
// Prepare parameters array
$parm = array(&$a,&$b,&$c,&$d,&$e,&$f,&$g,&$h);
foreach (self::$extensions[$event] as $calee) {
if ($ans === false) return false;
// Everything is ok by default
* When this flag is FALSE, the template must be re-evaluated.
* This variable contains the response buffer that is generated
* Construct the GL Template, using the file specified
* Convert this into a string
* Returns the 'text' variable, if exists.
public function fetch() {
self::call_extension('pre', $this->vars);
// Start OB and render file
self::call_extension('post', $buf);
|