Пример #1
0
 public function setup()
 {
     M_Office_Util::$mainOptions = PEAR::getStaticProperty('m_office', 'options');
     M::addPaths('module', array(APP_ROOT . 'app/_shared/modules/', APP_ROOT . 'app/' . APP_NAME . '/modules/', 'M/Office/modules/'));
     M::addPaths('template', array(OFFICE_TEMPLATES_FOLDER, APP_ROOT . 'app/_shared/templates/', APP_ROOT . 'app/' . APP_NAME . '/templates/'));
     if (Config::getPref('theme')) {
         M::addPaths('template', array(APP_ROOT . 'public/themes/' . Config::getPref('theme') . '/templates/'));
     }
     $tpl = new Mtpl(M::getPaths('template'));
     $tpl->assign('jsdir', SITE_URL . 'js/');
     Mreg::set('tpl', $tpl);
 }
Пример #2
0
 public function get_part($file, $params = array(), $autoglobal = false)
 {
     $tpl = new Mtpl($this->_config['tplfolders']);
     if ($autoglobal) {
         $tpl->setVars($this->getVars());
     }
     if (is_array($params)) {
         foreach ($params as $var => &$value) {
             if (is_object($value)) {
                 $tpl->assignRef($var, $value);
             } else {
                 $tpl->assign($var, $value);
             }
         }
     }
     return $tpl->fetch($file);
 }