Core::initSmarty PHP Method

initSmarty() private static method

Initializes the Smarty object used for things like rendering the Smarty templates found in resources/templates/ - and for other misc uses.
private static initSmarty ( )
    private static function initSmarty()
    {
        self::$smarty = new SecureSmarty();
        self::$smarty->template_dir = realpath(__DIR__ . "/../templates/");
        self::$smarty->compile_dir = realpath(__DIR__ . "/../../cache/");
        self::$smarty->assign("version", self::getVersion());
        self::$smarty->assign("samePage", Utils::getCleanPhpSelf());
    }

Usage Example

示例#1
0
    }
});
/*
set_error_handler(function($code, $text, $file, $row) {
    echo "Code: " . $code;
    echo "Text: " . $text;
    echo "File: " . $file;
    echo "Row: " . $row;
    debug_print_backtrace();
});*/
if (!is_dir(Core::getConfig("tempDir"))) {
    mkdir(Core::getConfig("tempDir"));
}
include $config["dirIntRoot"] . "assets/frameworks/smarty-3.1.27/Smarty.class.php";
$smarty = new Smarty();
Core::initSmarty($smarty);
PageManager::assignSmarty($smarty);
UserManager::initialize();
// Breadcrumbs
$baseDir = Core::GetConfig("dirRoot");
if (isset($_SERVER['REQUEST_URI'])) {
    $uri = str_replace($baseDir, "", $_SERVER['REQUEST_URI']);
    if (strpos($uri, "?") !== false) {
        $uri = explode("?", $uri);
        $uri = $uri[0];
    }
    $bc = explode("/", $uri);
    $bcc = array();
    foreach ($bc as $key => $value) {
        $bcc[$key][0] = $value;
        $bcc[$key][1] = $baseDir . $value;