4 * Smarty Method RegisterClass
6 * Smarty::registerClass() method
9 * @subpackage PluginsInternal
12 class Smarty_Internal_Method_RegisterClass
15 * Valid for Smarty and template object
22 * Registers static classes to be used in templates
24 * @api Smarty::registerClass()
25 * @link http://www.smarty.net/docs/en/api.register.class.tpl
27 * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
28 * @param string $class_name
29 * @param string $class_impl the referenced PHP class to
32 * @return \Smarty|\Smarty_Internal_Template
33 * @throws \SmartyException
35 public function registerClass(Smarty_Internal_TemplateBase $obj, $class_name, $class_impl)
37 $smarty = $obj->_getSmartyObj();
39 if (!class_exists($class_impl)) {
40 throw new SmartyException("Undefined class '$class_impl' in register template class");
43 $smarty->registered_classes[ $class_name ] = $class_impl;