A simple smarty template class requires only one file. Thank you for choosing ecshop.
TestCode:
Require_once 'Cls _ template. php' ; $ Smarty = New Cls_template; $ Smarty -> Cache_lifetime = 30 ; $ Smarty -> Template_dir = Dirname ( _ File __ ). '/Cache/smarty/template /' ; $ Smarty -> Cache_dir = Dirname ( _ File __ ). '/Cache/smarty/Cache /' ; $ Smarty -> Compile_dir = Dirname ( _ File __ ). '/Cache/smarty/compiled /' ; $ Smarty -> Direct_output = False ; $ Smarty -> Force_compile = True ; $ Array = Array (1, 2, 3, 4, 5 ); $ Smarty -> Assign ('array ', Array ( 'Egw _ polls' => Array ( 'Fd '=> Array ( 'Poll _ id' => Array ('Type' => 'auto', 'nulllable' => False ), 'Poll _ title' => Array ('Type' => 'varchar ', 'precision' => '000000', 'nulllable' => False ), 'Poll _ timestamp' => Array ('Type' => 'int', 'precision '=> '8', 'nulllable' => False ), 'Poll _ visable' => Array ('Type' => 'int', 'precision '=> '4', 'nulllable' => False , 'Default' => '0'), 'Poll _ votable' => Array ('Type' => 'int', 'precision '=> '4', 'nulllable' => False , 'Default' => '0 '), ) , 'Pk' => Array ('Poll _ id'), 'fk '=> Array (), 'Ix '=> Array (), 'Uc' => Array ()) , 'Egw _ polls_answers' => Array ( 'Fd '=> Array ( 'Answer _ id' => Array ('Type' => 'auto', 'nulllable' =>False ), 'Poll _ id' => Array ('Type' => 'int', 'precision '=> '4', 'nulllable' => False ), 'Answer _ text' => Array ('Type' => 'varchar ', 'precision' => '000000', 'nulllable' => False ), 'Answer _ votes '=> Array ('Type' => 'int', 'precision '=> '4', 'nulllable' => False , 'Default' => '0 '), ) , 'Pk' => Array ('Answer _ id'), 'fk '=> Array (), 'Ix '=> Array ('Poll _ id'), 'uc' => Array ()))); $ Smarty -> Assign ('name', 'omnitrix' ); $ Smarty -> Assign ('user ', Array ('Name' => 'admin', 'Password' => '000000', 'email '=> 'admin @ admin.com' )); $ Smarty -> Display ('T1. TPL ');
Test template:
<Br/> name :{ $ Name } <Br/> admin :{ $ User . Name} <Br/> password :{ $ User . Password} <Br/> Email :{ $ User . Email | Upper | escape: URL }{ Foreach From = $ Array Key = Table_name item = table_info name = ABC} <Br/> {$ Table_name }:{ $ Smarty . Foreach . ABC. First }:{ $ Smarty . Server. Php_self} {foreachelse} <Br/> nothing. { / Foreach }
The class file cls_template.php is located in ecshop/schemdes. You can find it after downloading the source code of ecshop.