public function removeNoCacheHash(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template,
                                      $no_output_filter)
    {
        $content = ob_get_clean();
        unset($cached->hashes[$_template->compiled->nocache_hash]);
        if (!empty($cached->hashes)) {
            $hash_array = array();
            foreach ($cached->hashes as $hash => $foo) {
                $hash_array[] = "/{$hash}/";
            }
            $content = preg_replace($hash_array, $_template->compiled->nocache_hash, $content);
        }
        $_template->cached->has_nocache_code = false;
        // get text between non-cached items
        $cache_split =
            preg_split("!/\*%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*/!s",
                       $content);
        // get non-cached items
        preg_match_all("!/\*%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*/!s",
                       $content, $cache_parts);
        $content = '';
        // loop over items, stitch back together
        foreach ($cache_split as $curr_idx => $curr_split) {
            // escape PHP tags in template content
            $content .= preg_replace('/(<%|%>|<\?php|<\?|\?>|<script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*>)/',
                                     "<?php echo '\$1'; ?>\n", $curr_split);
            if (isset($cache_parts[0][$curr_idx])) {
                $_template->cached->has_nocache_code = true;
                $content .= $cache_parts[1][$curr_idx];
            }
        }
        if (!$no_output_filter && !$_template->compiled->has_nocache_code &&
            (isset($_template->smarty->autoload_filters['output']) ||
                isset($_template->smarty->registered_filters['output']))
        ) {
            $content = $_template->smarty->ext->_filterHandler->runFilter('output', $content, $_template);
        }
        // write cache file content
        $this->writeCachedContent($cached, $_template, $content);
    }