Example #1
0
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <*****@*****.**>
*  @copyright  2007-2015 PrestaShop SA
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
define('_PS_SMARTY_DIR_', _PS_TOOL_DIR_ . 'smarty/');
require_once _PS_SMARTY_DIR_ . 'Smarty.class.php';
global $smarty;
$smarty = new SmartyCustom();
$smarty->setCompileDir(_PS_CACHE_DIR_ . 'smarty/compile');
$smarty->setCacheDir(_PS_CACHE_DIR_ . 'smarty/cache');
if (!Tools::getSafeModeStatus()) {
    $smarty->use_sub_dirs = true;
}
$smarty->setConfigDir(_PS_SMARTY_DIR_ . 'configs');
$smarty->caching = false;
if (Configuration::get('PS_SMARTY_CACHING_TYPE') == 'mysql') {
    include _PS_CLASS_DIR_ . '/SmartyCacheResourceMysql.php';
    $smarty->caching_type = 'mysql';
}
$smarty->force_compile = Configuration::get('PS_SMARTY_FORCE_COMPILE') == _PS_SMARTY_FORCE_COMPILE_ ? true : false;
$smarty->compile_check = Configuration::get('PS_SMARTY_FORCE_COMPILE') >= _PS_SMARTY_CHECK_COMPILE_ ? true : false;
$smarty->debug_tpl = _PS_ALL_THEMES_DIR_ . 'debug.tpl';
/* Use this constant if you want to load smarty without all PrestaShop functions */
Example #2
0
 public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
 {
     if ($this->smarty->caching) {
         $tpl = parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter);
         if (property_exists($this, 'cached')) {
             $filepath = str_replace($this->smarty->getCacheDir(), '', $this->cached->filepath);
             if ($this->smarty->is_in_lazy_cache($this->template_resource, $this->cache_id, $this->compile_id) != $filepath) {
                 $this->smarty->update_filepath($filepath, $this->template_resource, $this->cache_id, $this->compile_id);
             }
         }
         return $tpl;
     } else {
         return parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter);
     }
 }