writeCachedContent example

// rendering (must be done before writing cache file because of {function} nocache handling)                 $_smarty_tpl = $_template;
                try {
                    ob_start();
                    eval("?>" . $output);
                    $_output = ob_get_clean();
                } catch (Exception $e) {
                    ob_get_clean();
                    throw $e;
                }
                // write cache file content                 $_template->writeCachedContent($output);
                if ($this->smarty->debugging) {
                    Smarty_Internal_Debug::end_cache($_template);
                }
            } else {
                // var_dump('renderTemplate', $_template->has_nocache_code, $_template->template_resource, $_template->properties['nocache_hash'], $_template->parent->properties['nocache_hash'], $_output);                 if (!empty($_template->properties['nocache_hash']) && !empty($_template->parent->properties['nocache_hash'])) {
                    // replace nocache_hash                     $_output = str_replace("{$_template->properties['nocache_hash']}", $_template->parent->properties['nocache_hash']$_output);
                    $_template->parent->has_nocache_code = $_template->parent->has_nocache_code || $_template->has_nocache_code;
                }
            }
        }
/** * Write this cache object to handler * * @param Smarty_Internal_Template $_template template object * @param string $content content to cache * @return boolean success */
    public function write(Smarty_Internal_Template $_template$content)
    {
        if (!$_template->source->recompiled) {
            if ($this->handler->writeCachedContent($_template$content)) {
                $this->timestamp = time();
                $this->exists = true;
                $this->valid = true;
                if ($_template->smarty->cache_locking) {
                    $this->handler->releaseLock($_template->smarty, $this);
                }
                return true;
            }
        }
        return false;
    }

}
Home | Imprint | This part of the site doesn't use cookies.