コード例 #1
0
    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
ファイル: installWizard.php プロジェクト: hadrienl/jelix
 function run($isAlreadyDone = false)
 {
     try {
         $this->readConfiguration();
         $this->initPath();
         $laststep = $this->initPrevious();
         $this->lang = $this->guessLanguage();
         if ($isAlreadyDone && !isset($_SESSION['__install__wizard'])) {
             if (isset($this->config['onalreadydone'])) {
                 $laststep = $this->config['onalreadydone'];
             }
             if ($laststep != '' && isset($this->pages[$laststep])) {
                 $this->stepName = $laststep;
             } else {
                 throw new Exception("Application is installed. The script cannot be runned.");
             }
         } else {
             if (!isset($_SESSION['__install__wizard']) && !$isAlreadyDone) {
                 $_SESSION['__install__wizard'] = true;
             }
             $this->stepName = $this->getStepName();
         }
         jTplConfig::$lang = $this->lang;
         jTplConfig::$localesGetter = array($this, 'getLocale');
         jTplConfig::$cachePath = $this->tempPath;
         $page = $this->loadPage();
         if (isset($_POST['doprocess']) && $_POST['doprocess'] == "1") {
             //if ($isAlreadyDone)
             //    $result = true;
             //else
             $result = $page->process();
             if ($result !== false) {
                 header("location: ?step=" . $this->getNextStep($page, $result));
                 exit(0);
             }
         }
         $tpl = new jTpl();
         $tpl->assign($page->config);
         $tpl->assign($page->getErrors());
         $tpl->assign('appname', isset($this->config['appname']) ? $this->config['appname'] : '');
         $continue = $page->show($tpl);
         $content = $tpl->fetch($this->stepName . '.tpl', 'html');
         $this->showMainTemplate($page, $content, $continue);
         if ($laststep == $this->stepName) {
             session_destroy();
         }
     } catch (Exception $e) {
         $error = $e->getMessage();
         header("HTTP/1.1 500 Application error");
         if ($this->customPath && file_exists($this->customPath . 'error.php')) {
             require $this->customPath . 'error.php';
         } else {
             require dirname(__FILE__) . '/error.php';
         }
         exit(1);
     }
 }
コード例 #3
0
ファイル: exemple.php プロジェクト: hadrienl/jelix
<?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');