Пример #1
0
<?php

require_once "../WEB-INF/classes/lite/LiteEngine.php";
$engine = new LiteEngine();
$i18n_path = $engine->root . '/WEB-INF/i18n/zh/';
if (@$_COOKIE["i18n_lang"] == 'en') {
    $i18n_path = $engine->root . '/WEB-INF/i18n/en/';
    if (realpath($i18n_path)) {
        $engine->i18ncode = $i18n_path;
    }
}
$engine->debug = true;
$engine->autocompile = false;
//初始化Lite Logo 的点阵数据
$path = @$_SERVER['PATH_INFO'];
$action = @$_POST['i18n_action'];
if ($action == 'save') {
    if (@$i18n_path) {
        $i18n_id = $_POST['i18n_id'];
        $i18n_value = $_POST['i18n_value'];
        $pos = strpos($i18n_id, '__');
        $file = $i18n_path . substr($i18n_id, 0, $pos) . '.i18n';
        if (file_exists($file)) {
            $i18n_data = json_decode(file_get_contents($file), true);
        } else {
            $i18n_data = array();
        }
        $i18n_data[$i18n_id] = $i18n_value;
        file_put_contents($file, json_encode($i18n_data));
        echo '{"success":true,"path":"' + $file + '"}';
    } else {
Пример #2
0
<?php

require_once dirname(__FILE__) . "/../WEB-INF/classes/lite/LiteEngine.php";
$engine = new LiteEngine();
# 通过上下文数据方式传递模板参数:
$context = array("int1" => 1, "text1" => '1');
$engine->render("/example/extends-page.xhtml", $context);
Пример #3
0
<?php

require_once "../WEB-INF/classes/lite/LiteEngine.php";
$engine = new LiteEngine();
$engine->encoding = "UTF-8";
header("Content-type: text/html;charset=UTF-8");
//初始化Lite Logo 的点阵数据
$data = array();
if (array_key_exists('PATH_INFO', $_SERVER)) {
    $path = $_SERVER['PATH_INFO'];
    $path = '/book' . $path;
} else {
    echo "<script>document.location='index.php/index.xhtml'</script>";
    exit;
}
if (realpath("../" . $path)) {
    if (strpos($path, ".xhtml") > 0) {
        $engine->render($path, $data);
    } else {
        readfile(".." . $path);
    }
} else {
    echo '<h3>找不到文件:' . $path . '</h3>';
}