Skip to content

Instantly share code, notes, and snippets.

@RabeaWahab
Created January 5, 2015 02:19
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/9f3df0530b616366441c to your computer and use it in GitHub Desktop.
Save RabeaWahab/9f3df0530b616366441c to your computer and use it in GitHub Desktop.
<?php
class Packagename_Modulename_Model_Punchhole2 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_CMSWIDGET_CACHED_ID' . md5($this->_placeholder->getAttribute('cache_id') . $this->_getIdentifier());
}
/**
* Render block content
*
* @return string
*/
protected function _renderBlock()
{
$block = $this->_placeholder->getAttribute('block');
if($block == 'Mage_Cms_Block_Widget_Block'){
$block = 'Mage_Cms_Block_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