繁体   English   中英

Magento LiteMage缓存-从缓存中排除块

[英]Magento LiteMage Cache - Excluding a block from caching

我有一个启用了LiteMage缓存的Magento网站。 我的网站在每个页面上都有一个共同的标题。 在标题中,我有以下代码,该代码检查是否已登录客户以显示“帐户”(如果已登录)或显示“登录”。

我的问题是,当客户登录时,它在某些页面上仍显示“登录”,而在其他页面上仍显示“帐户”。

我相信此问题与我的缓存有关,如何解决此问题? 如果应该解决的话,如何设置从LiteMage中缓存该特定块。

以下代码是我在header.phtml中拥有的代码的相关部分

<?php
        //check the user is logged on or not
        if (! Mage::getSingleton('customer/session')->isLoggedIn()){
        //if user logged on show the logout link - add this code within anchor tag
        echo '<a href="'.Mage::helper('customer')->getLoginUrl().'">'.$this->__('Log In').'</a>';
        }
        else{
        //if user is not logged on yet show the login link - add this code within anchor tag
        echo '<a href="'.$this->getUrl('friends').'">'.$this->__('Account').'</a>';
        }
      ?>

您需要确定哪个块包含此代码。 与默认的magento样本数据一样,登录链接位于“ top.links”内,并且该框已打孔。 尽量不要使用完整的标头,范围越小,速度越快。 知道块名称后,可以将其添加到“自定义顶部链接的块名称”中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM