示例#1
0
    $_struct = new structure('xml/structure.xml');
    $_out = new out();
    $_sec = $_struct->getCurrentSection();
    $m = new modules($_site, 'modules');
    $m->run();
    $_sec->getModules()->run();
    $_out->xmlInclude($_struct);
    $_out->xmlInclude($_site->getSiteInfo());
    $_tpl = $_sec->getTemplate();
    //$_out->save('temp.xml');
    echo $_tpl->transform($_out);
} catch (Exception $e) {
    switch ($e->getCode()) {
        case EXCEPTION_404:
            header("HTTP/1.0 404 Not Found");
            $_site = new site('xml/site.xml');
            $_struct = new structure('xml/structure.xml');
            $_out = new out();
            $_out->setMeta('title', '404 Page not found');
            $_sec = $_struct->addSection('error404', '404');
            $_sec->setSelected(true);
            $_out->xmlInclude($_struct);
            $_out->xmlInclude($_site->getSiteInfo());
            $_tpl = new template($_struct->getTemplatePath() . 'default.xsl');
            $_tpl->addTemplate($_struct->getTemplatePath() . '404.xsl');
            echo $_tpl->transform($_out);
            break;
        default:
            echo 'Exception: ' . $e->getMessage();
    }
}