2 /*=====================================================================*\
3 || ################################################################### ||
4 || # Iris Studios Shared Object Framework [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # All parts of this file are ©2003-[#]year[#] Iris Studios, Inc. No # ||
7 || # part of this file may be reproduced in any way: part or whole. # ||
8 || # --------------------------------------------------------------- # ||
9 || # ©2003 - [#]year[#] Iris Studios, Inc. | http://www.iris-studios.com # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 if (!$this->is_loaded('template'))
15 $this->locate('template');
18 $OBJECT = 'File-Based Template System';
19 $CLASS = 'FS_Template';
23 * File System Template System
25 * This framework merely replaces the template loading functions with
26 * file-system based ones.
28 * @author Iris Studios, Inc.
29 * @copyright Copyright ©2003 - [#]year[#], Iris Studios, Inc.
33 class FS_Template
extends DB_Template
36 * Global environment variables
38 * @var templatedir Directory name that houses the templates
39 * @var extension The extension used on template files
41 var $templatedir = '';
42 var $extension = 'tpl';
45 * Takes an array of template names, loads them, and then stores
46 * a parsed version for optimum speed.
48 * @param array List of template names to be cached
50 function cache($namearray)
52 if (sizeof($this->cache
) > 0)
54 trigger_error('You cannot cache templates more than once per initialization', ERR_ALERT
);
58 foreach ($namearray AS $name)
60 $template = $this->_load($name);
61 $template = $this->_parse($template);
62 $this->cache
["$name"] = $template;
63 $this->usage["$name"] = 0;
69 * Loads a template from the file system from the specified $templatedir
70 * with the file extension $extension
72 * @param str The name of the template call
78 $path = $_isso->apppath
. $this->templatedir
. $name . '.' . $this->extension
;
81 if (($template = @file_get_contents($path)) !== false)
87 trigger_error("Could not load the template '$path'", ERR_FATAL);
93 trigger_error("Could not load the template
'$path'", ERR_FATAL);
99 /*=====================================================================*\
100 || ###################################################################
103 || ###################################################################
104 \*=====================================================================*/