Class Controller { Public $ tpl; Public $ controller; Public $ body; // right menu Public $ _ route; Public $ html _; Public $ tpl _; /* * Constructor */ Public function _ construct () { $ This-> init (); } /* * Initialize variables, top menus, and templates */ Protected function init () { Global $ TPL, $ route; $ This-> tpl = $ TPL; $ This-> _ route = $ route; } /** * Pass the template variable to */ Protected function diplayTpl () { $ This-> body | $ this-> body = $ this-> _ route-> getActionName (); $ This-> tpl-> assign ("body", $ this-> body ); /* Set the template directory of this controller */ $ This-> controller | $ this-> controller = $ this-> _ route-> getControllerName (); $ This-> tpl-> assign ("controller", $ this-> controller ); $ This-> tpl-> display ($ this-> layout ); } /** * Smarty encapsulation class * @ Param string $ name * @ Param string $ value */ Public function assign ($ name, $ value) { $ This-> tpl-> assign ($ name, $ value ); } /** * Display another template * @ Param string $ name * @ Param string $ value */ Protected function displayOther ($ file) { $ This-> assign ("otherTpl", TRUE ); $ This-> tpl-> display ($ file ); } /** * Display the body template of a MCA * 0 => m 1 => c => */ Protected function getMcaBody ($ array) { Return 'http: // response } /* * Destructor. The page is displayed. */ Protected function _ destruct () { $ This-> tpl-> _ tpl_vars ['othertpl '] | $ this-> diplayTpl (); } /** * Exit midway through */ Protected function _ exit ($ msg = "") { $ This-> assign ("otherTpl", TRUE ); Die ($ msg ); } /** * Use the $ this-> html_var = value placement method to assign values to variables. * Use the $ this-> tpl_var = value placement method to assign values to variables. */ Protected function _ set ($ name, $ value) { If (strtolower (substr ($ name,) = "html _" | strtolower (substr ($ name,) = "tpl _") { $ This-> assign (substr ($ name, 5), $ value ); } } } ?> |