static $localizedMessages = array();
    /**
     * @internal
     */
    static $pluginPathList = array();
    static function addPluginsRepository($path)
    {
        if (trim($path) == '') {
            return;
        }
        if (!file_exists($path)) {
            throw new Exception('The given path, ' . $path . ' doesn\'t exists');
        }
        if (substr($path, -1) != '/') {
            $path .= '/';
        }
        if ($handle = opendir($path)) {
            while (false !== ($f = readdir($handle))) {
                if ($f[0] != '.' && is_dir($path . $f)) {
                    self::$pluginPathList[$f][] = $path . $f . '/';
                }
            }
            closedir($handle);
        }
    }
}
jTplConfig::$cachePath = realpath(JTPL_PATH . 'temp/') . '/';
jTplConfig::$localizedMessagesPath = realpath(JTPL_PATH . 'locales/') . '/';
jTplConfig::$templatePath = realpath(JTPL_PATH . 'templates/') . '/';
jTplConfig::addPluginsRepository(realpath(JTPL_PATH . 'plugins/'));
include JTPL_PATH . 'jTpl.class.php';
示例#2
0
 protected function showMainTemplate($page, $content, $continue)
 {
     $filename = "wiz_layout.tpl";
     $path = $this->getRealPath('', $filename);
     jTplConfig::$templatePath = dirname($path) . '/';
     $this->loadLocales('', 'wiz_layout');
     $conf = $this->config[$this->stepName . '.step'];
     $tpl = new jTpl();
     $tpl->assign('title', $page->getLocale($page->title));
     if (isset($conf['messageHeader'])) {
         $tpl->assign('messageHeader', $conf['messageHeader']);
     } else {
         $tpl->assign('messageHeader', '');
     }
     if (isset($conf['messageFooter'])) {
         $tpl->assign('messageFooter', $conf['messageFooter']);
     } else {
         $tpl->assign('messageFooter', '');
     }
     $tpl->assign('MAIN', $content);
     $tpl->assign(array_merge(array('enctype' => ''), $conf));
     $tpl->assign('stepname', $this->stepName);
     $tpl->assign('lang', $this->lang);
     $tpl->assign('next', $continue && isset($conf['next']));
     $tpl->assign('previous', isset($conf['__previous']) ? $conf['__previous'] : '');
     $tpl->assign('appname', isset($this->config['appname']) ? $this->config['appname'] : 'Application');
     $tpl->display($filename, 'html');
 }
示例#3
0
<?php

error_reporting(E_ALL);
include '../jtpl_standalone_prepend.php';
jTplConfig::$cachePath = dirname(__FILE__) . '/../temp/';
jTplConfig::$templatePath = dirname(__FILE__) . '/';
$tpl = new jTpl();
$countries = array('France', 'Italie', 'Espagne', 'Belgique');
$tpl->assign('countries', $countries);
$tpl->assign('titre', 'This is a test !');
$tpl->display('test.tpl');
$tpl = new jTpl();
$tpl->assign('titre', 'This is an other test !');
$tpl->display('foo/test.tpl');