Я использую Magento Enterprise 1.10.1.1 и мне нужно получить динамический контент на страницах товаров. Я вставляю текущее время в блок, чтобы быстро проверить, работает ли он, но не могу пробиться через полный кэш страницы.
Я пробовал различные варианты реализации, найденные здесь:
http://tweetorials.tumblr.com/post/10160075026/ee-full-page-cache-hole-punching http://oggettoweb.com/blog/customizations-compatible-magento-full-page-cache/ http://magentophp.blogspot.com/2011/02/magento-enterprise-full-page-caching.html
Любые решения, мысли, комментарии, советы приветствуются.
вот мой код:
app/code/local/Fido/Example/etc/config.xml
0.1.0
Fido_Example_Block
app/code/local/Fido/Example/etc/cache.xml
fido_example/view
example
CACHE_TEST
Fido_Example_Model_Container_Cachetest
86400
app/code/local/Fido/Example/Block/View.php
message = $msg;
}
public function receiveMessage() {
if($this->message != '') {
return $this->message;
}
else {
$this->createMessage('Hello World');
return $this->message;
}
}
protected function _toHtml() {
$html = parent::_toHtml();
if($this->att = $this->getMyCustom() && $this->getMyCustom() != '') {
$html .= '
'.$this->att;
}
else {
$now = date('m-d-Y h:i:s A');
$html .= $now;
$html .= '
' ;
}
return $html;
}
}
app/code/local/Fido/Example/Model/Container/Cachetest. php
_placeholder->getAttribute('cache_id') . $this->_getIdentifier());
}
protected function _renderBlock()
{
$blockClass = $this->_placeholder->getAttribute('block');
$template = $this->_placeholder->getAttribute('template');
$block = new $blockClass;
$block->setTemplate($template);
return $block->toHtml();
}
protected function _saveCache($data, $id, $tags = array(), $lifetime = null) { return false; }
}
app/design/frontend/enterprise/[mytheme]/template/example/view.phtml
receiveMessage() ?>
snippet from app/design/frontend/enterprise/[mytheme]/layout/catalog.xml