コード例 #1
0
ファイル: STpl.class.php プロジェクト: jianyongchen/smpss
 /**
  * render a .tpl
  */
 public function render($tpl, $parames = array())
 {
     parent::$compile_dir = SlightPHP::$appDir . DIRECTORY_SEPARATOR . "templates_c";
     parent::$template_dir = SlightPHP::$appDir . DIRECTORY_SEPARATOR . "templates";
     parent::assign($parames);
     return parent::fetch("{$tpl}");
 }
コード例 #2
0
ファイル: STpl.class.php プロジェクト: luofei614/slightphp
 /**
  * like as render except delimiter 
  */
 public function display($tpl, $parames = array())
 {
     parent::$compile_dir = SlightPHP::$appDir . DIRECTORY_SEPARATOR . "templates_c";
     parent::$template_dir = SlightPHP::$appDir . DIRECTORY_SEPARATOR . "templates";
     parent::$left_delimiter = '<{';
     parent::$right_delimiter = '}>';
     parent::assign($parames);
     return parent::fetch("{$tpl}");
 }
コード例 #3
0
ファイル: Tpl.function.php プロジェクト: ssdphp/ssdphp
function tpl_function_include($tpl)
{
    return Tpl::fetch($tpl);
}
コード例 #4
0
ファイル: index.php プロジェクト: heptalium/flyspray
 /**
  * Function to output the templates
  * @param array $templates The collection of templates with their associated variables
  *
  */
 function OutputPage($templates = array())
 {
     if (sizeof($templates) == 0) {
         trigger_error("Templates not configured properly", E_USER_ERROR);
     }
     // Define a set of common variables which plugin to the structure template.
     $page = new Tpl();
     $body = '';
     // Loop through the templates array to dynamically create objects and assign variables to them.
     /// XXX: this is not a common way to use our template class, but I didn't want to rewrite
     ///      the whole setup only to change the templating engine
     foreach ($templates as $name => $module) {
         foreach ($module['vars'] as $var_name => $value) {
             $page->assign($var_name, $value);
         }
         if ($name == 'structure') {
             $page->assign('body', $body);
             $page->display('structure.tpl');
         } else {
             $body .= $page->fetch($module['template']);
         }
     }
 }