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

时间:2015-11-26 10:23:35

标签: magento

我有一个带有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>';
        }
      ?>

1 个答案:

答案 0 :(得分:0)

您需要确定哪个块包含此代码。与默认的magento样本数据一样,登录链接位于&#34; top.links&#34;内,并且该块保持打孔状态。尽量不要使用完整的标题,范围越小,它就越快。一旦知道了块名称,就可以在&#34;自定义块名称中添加顶部链接&#34;。

相关问题