public function render($tpl_name)
 {
     $tpl = new STemplate();
     $tpl->vars =& $this->page->vars;
     $tpl->controls =& $this->page->controls;
     return $tpl->process($tpl_name);
 }
예제 #2
0
 public static function render_layout($ctx, $content, $params)
 {
     $tpl = new STemplate();
     $tpl->vars['__content__'] = $content;
     if ($params === null) {
         $params = array('path' => '');
     }
     if (array_key_exists('controller', $ctx->params)) {
         $ctx->params['controller']->process($ctx, $params, $tpl->vars);
     }
     $path = BASE . 'layouts/' . $ctx->layout . '.php';
     if (@file_exists($path)) {
         require_once $path;
         $class_name = self::capitalize_words($ctx->layout) . 'Layout';
         $layout_inst = new $class_name();
         $layout_inst->process($ctx, $params, $tpl->vars);
     }
     return $tpl->process(BASE . 'layouts/' . $ctx->layout . '.tpl');
 }
 protected function error_handler()
 {
     $tpl = new STemplate();
     $tpl->vars =& $this->vars;
     $tpl->controls =& $this->controls;
     $tpl->vars['__error__'] = $this->_error_message;
     $res = $tpl->process($this->error_page_name);
     $this->output_result($res);
 }
 protected function render_template()
 {
     if (!strlen($this->template_name)) {
         throw new Exception('Please set $template_name variable');
     }
     $tpl = new STemplate();
     $tpl->vars =& $this->vars;
     $tpl->controls =& $this->page->controls;
     return $tpl->process($this->template_name);
 }
<?php

require_once 's/s.php';
$tpl = new STemplate();
$tpl->vars['show_login_box'] = _SESSION('show_login_box', true);
$tpl->vars['login_error'] = '';
$tpl->vars['user_name'] = _SESSION('user_name');
if (inPOST('try_it')) {
    if (_POST('login') != 'test' || _POST('password') != '12345') {
        $tpl->vars['login_error'] = 'Invalid credentials. Try test/12345';
    } else {
        $_SESSION['user_name'] = 'Test test';
        $_SESSION['show_login_box'] = false;
        header('Location: ?' . (inGET('gimmedebug') ? 'gimmedebug=1' : ''));
        return;
    }
}
if (inPOST('try_again')) {
    $_SESSION['show_login_box'] = true;
    header('Location: ?' . (inGET('gimmedebug') ? 'gimmedebug=1' : ''));
    return;
}
echo $tpl->process(BASE . 'index.tpl');
if (DEBUG) {
    echo_debug();
}
 public function render_form($data)
 {
     $tpl = new STemplate();
     if (!array_key_exists('buttons', $data)) {
         $data['buttons'] = array(array('id' => 'save', 'title' => Loc::get('cms/admin/save'), 'validate' => true));
     }
     if (!array_key_exists('fields_width', $data)) {
         $data['fields_width'] = 480;
     }
     $tpl->vars['action_url'] = $this->get_action_url();
     $tpl->vars['data'] = $data;
     $tpl->vars['self'] = $this;
     return $tpl->process(dirname(__FILE__) . '/base_admin_module.tpl');
 }