Пример #1
0
define('ABS_PATH_DATA_CLIENT', 'xml/data/');
define('ABS_PATH_TPL_CLIENT', 'xml/templates/');
define('ABS_PATH_DATA_AP', 'ap/xml/data/');
define('ABS_PATH_USERS', 'ap/xml/users.xml');
//пути к файлам клиентской части относительно текущей папки
define('PATH_ROOT', '../');
define('PATH_STRUCT_CLIENT', PATH_ROOT . ABS_PATH_STRUCT_CLIENT);
define('PATH_TPL_CLIENT', PATH_ROOT . ABS_PATH_TPL_CLIENT);
try {
    $_site = new site('../xml/site.xml');
    $_struct = new structure('xml/structure.xml', 'xml/data', 'xml/templates');
    $_out = new out();
    $_events = new events('xml/events.xml');
    $_events->addEvent('SectionReady');
    $_events->addEvent('PageReady');
    $_site->setModules(new modules($_site, 'apModules'));
    $modules = $_site->getModules();
    if (!$modules->hasModule('ap')) {
        $modules->move($modules->add('ap'), 1);
    }
    $modules->run();
    $_sec = $_struct->getCurrentSection();
    $_events->happen('SectionReady');
    $_sec->getModules()->run();
    $_out->xmlInclude($_struct);
    $_out->xmlInclude($_site);
    $_events->happen('PageReady');
    $_tpl = $_sec->getTemplate();
    //$_out->save('temp.xml');
    $tmp = explode('/', trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/'));
    array_pop($tmp);