[Fission-commits] Fission Fission.php,1.5,1.6
Status: Planning
Brought to you by:
heimidal
|
From: <hei...@us...> - 2003-08-22 20:44:19
|
Update of /cvsroot/fission/Fission
In directory sc8-pr-cvs1:/tmp/cvs-serv6987
Modified Files:
Fission.php
Log Message:
Enabled batch template var setting.
Index: Fission.php
===================================================================
RCS file: /cvsroot/fission/Fission/Fission.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Fission.php 13 Aug 2003 00:30:05 -0000 1.5
--- Fission.php 22 Aug 2003 15:56:46 -0000 1.6
***************
*** 28,31 ****
--- 28,34 ----
var cache_root = '';
+ // Contains an array of current template vars.
+ var _tpl_vars = array();
+
// __construct function introduced in PHP5.
//
***************
*** 59,62 ****
--- 62,96 ----
{
+ }
+
+ // Defines a single or a set of template
+ // variables to be replaced within templates.
+ // For the time being, error handling is
+ // transparent.
+ //
+ // @var vars public string|array
+ // @var var_content public string optional
+ function set_vars($vars, $var_content=false)
+ {
+ if(is_array( $vars ))
+ {
+ foreach( $vars as $key => $val )
+ {
+ if(preg_match('/^[a-z][a-z0-9_-]+/', $key))
+ {
+ $this->_tpl_vars[$key] = $val;
+ }
+ }
+ return true;
+ }
+ elseif( (!empty($vars)) && (preg_match('/^[a-z][a-z0-9_-]+/', $vars)) && (!empty($vars_content)) )
+ {
+ $this->_tpl_vars[$vars] = $var_content;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
|