2 /*=====================================================================*\
3 || ###################################################################
4 || # Iris Studios Shared Object Framework [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
23 * File System Template System
29 if (!$this->is_loaded('template'))
31 $this->locate('template');
34 $OBJECT = 'File-Based Template System';
35 $CLASS = 'FS_Template';
39 * File System Template System
41 * This framework merely replaces the template loading functions with
42 * file-system based ones.
44 * @author Iris Studios, Inc.
45 * @copyright Copyright ©2002 - [#]year[#], Iris Studios, Inc.
50 class FS_Template
extends DB_Template
53 * The path, from the path of the application, where templates are stored
55 * @see Shared_Object_Framework::$apppath, _load()
57 var $templatedir = '';
60 * The extension all the template files have
64 var $extension = 'tpl';
67 * Takes an array of template names, loads them, and then stores
68 * a parsed version for optimum speed.
70 * @param array List of template names to be cached
72 function cache($namearray)
74 if (sizeof($this->cache
) > 0)
76 trigger_error('You cannot cache templates more than once per initialization', E_USER_WARNING
);
80 foreach ($namearray AS $name)
82 $template = $this->_load($name);
83 $template = $this->_parse($template);
84 $this->cache
["$name"] = $template;
85 $this->usage
["$name"] = 0;
91 * Loads a template from the file system from the specified $templatedir
92 * with the file extension $extension
94 * @param string The name of the template call
100 $path = $_isso->apppath
. $this->templatedir
. $name . '.' . $this->extension
;
103 if (($template = @file_get_contents($path)) !== false
)
109 trigger_error("Could not load the template '$path'", E_USER_ERROR
);
115 trigger_error("Could not load the template '$path'", E_USER_ERROR
);
121 /*=====================================================================*\
122 || ###################################################################
125 || ###################################################################
126 \*=====================================================================*/