Skip to content

Instantly share code, notes, and snippets.

@RabeaWahab
Created January 5, 2015 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RabeaWahab/8ef23444942e06fd2891 to your computer and use it in GitHub Desktop.
Save RabeaWahab/8ef23444942e06fd2891 to your computer and use it in GitHub Desktop.
<?php
class Packagename_Modulename_Model_Punchhole extends Enterprise_PageCache_Model_Container_Abstract
{
protected function _getIdentifier()
{
return $this->_getCookieValue(Enterprise_PageCache_Model_Cookie::COOKIE_CUSTOMER, '');
}
/**
* Get cache identifier
*
* @return string
*/
protected function _getCacheId()
{
return 'HTML_CMS_CACHED_ID' . md5($this->_placeholder->getAttribute('cache_id') . $this->_getIdentifier());
}
/**
* Render block content
*
* @return string
*/
protected function _renderBlock()
{
$block = $this->_placeholder->getAttribute('block');
$block = new $block;
// Get the block_id attribute we originally set in our CMS block's
// getCacheKeyInfo function.
$block_id = $this->_placeholder->getAttribute('block_id');
$block->setBlockId($block_id);
$block->setLayout(Mage::app()->getLayout());
return $block->toHtml();
}
protected function _saveCache($data, $id, $tags = array(), $lifetime = null)
{
return false;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment