1 <?php
3 /**
4 * Smarty method Register_Resource
5 *
6 * Registers a Smarty template resource
7 *
8 * @package Smarty
9 * @subpackage SmartyMethod
10 * @author Uwe Tews
11 */
13 /**
14 * Registers a resource to fetch a template
15 *
16 * @param object $smarty
17 * @param string $type name of resource
18 * @param array $functions array of functions to handle resource
19 */
20 function Smarty_Method_Register_Resource($smarty, $type, $functions)
21 {
22 if (count($functions) == 4) {
23 $smarty->_plugins['resource'][$type] =
24 array($functions, false);
25 } elseif (count($functions) == 5) {
26 $smarty->_plugins['resource'][$type] =
27 array(array(array(&$functions[0], $functions[1]) , array(&$functions[0], $functions[2]) , array(&$functions[0], $functions[3]) , array(&$functions[0], $functions[4])) , false);
28 } else {
29 throw new Exception("malformed function-list for '$type' in register_resource");
30 }
31 }
33 ?>