/** * Sets smarty compile dir * * @param unknown_type $dirPath */ public static function setCompileDir($dirPath) { if (!is_dir($dirPath)) { if (@mkdir($dirPath, 0777, true)) { chmod($dirPath, 0777); } } self::$compileDir = $dirPath; }
/** * Returns an instance of LiveCart Application * * Method prevents of creating multiple application instances during one request * * @return LiveCart */ public function __construct() { ClassLoader::import('application.model.ActiveRecordModel'); ClassLoader::import('framework.renderer.SmartyRenderer'); parent::__construct(); unset($this->session, $this->config, $this->locale, $this->localeName); $dsnPath = ClassLoader::getRealPath("storage.configuration.database") . '.php'; $this->isInstalled = file_exists($dsnPath); ActiveRecordModel::setApplicationInstance($this); if ($this->isInstalled) { ActiveRecordModel::setDSN(include $dsnPath); if (!session_id()) { $session = new DatabaseSessionHandler(); if ($this->getConfig()->get('USE_DEFAULT_SESSION_HANDLER') == false) { $session->setHandlerInstance(); } $this->sessionHandler = $session; } } // LiveCart request routing rules $this->initRouter(); if (file_exists(ClassLoader::getRealPath('cache.dev'))) { $this->setDevMode(true); } if ($this->isDevMode()) { ActiveRecordModel::getLogger()->setLogFileName(ClassLoader::getRealPath("cache") . DIRECTORY_SEPARATOR . "activerecord.log"); if (phpversion() >= '5.3') { error_reporting(E_ALL & ~E_DEPRECATED); } else { error_reporting(E_ALL); } ini_set('display_errors', 'On'); } $compileDir = $this->isTemplateCustomizationMode() ? 'cache.templates_c.customize' : 'cache.templates_c'; SmartyRenderer::setCompileDir(ClassLoader::getRealPath($compileDir)); // mod_rewrite disabled? if ($this->request->get('noRewrite')) { $this->router->setBaseDir($_SERVER['baseDir'], $_SERVER['virtualBaseDir']); //$this->router->enableURLRewrite(false); } }
public function render($view) { if (file_exists($view)) { $view = $this->getRelativeTemplatePath($view); } if (!file_exists($view)) { $original = $view; $view = $this->getTemplatePath($view); if (!$view) { throw new ViewNotFoundException($original); } } /*$cache = $this->getCache($view); if ($cache->isCached()) { return $cache->getData(); } */ $output = parent::render($view); $output = $this->applyLayoutModifications($view, $output); //$cache->setData('<div style="border: 2px solid red;">' . $output . '</div>'); //$cache->save(); //$this->cache = $cache->getParent(); return $output; }
public function render($view) { if (file_exists($view)) { $view = $this->getRelativeTemplatePath($view); } if (!file_exists($view)) { $original = $view; $view = $this->getTemplatePath($view); if (!$view) { throw new ViewNotFoundException($original); } } $output = parent::render($view); return $this->applyLayoutModifications($view, $output); }