简体   繁体   English

获取当前页面-Magento

[英]Getting current page - Magento

The thing is that I have logo displayed on only homepage in Magento checking if it's homepage with getIsHomepage();. 问题是我只有Magento的主页上显示徽标,并使用getIsHomepage();检查它的主页。 Now the thing I want to do is to display logo inside header only on Dashboard page, do you know any alternative to getIsHomepage but to check if it's My account page? 现在,我要做的是仅在“仪表板”页面上的标题内显示徽标,您是否知道getIsHomepage的其他替代方法,但要检查它是否是“我的帐户”页面?

Thanks 谢谢

It's best practice to use xml to do this instead of parsing url. 最好的做法是使用xml而不是解析url。 Add this to your local.xml: 将此添加到您的local.xml中:

<customer_account_index>
   <reference name="header">
            <action method="setTemplate"><template>page/html/customer_account_header.phtml</template></action>
        </reference>
</customer_account_index>

And copy and edit your header.phtml file to template/page/html/customer_account_header.phtml 并将您的header.phtml文件复制并编辑到template/page/html/customer_account_header.phtml

If you want to out logic for customer account page then 如果您想为客户帐户页面添加逻辑,则

First fetch current routers and controllers and action to headere.phtml 首先获取当前的路由器和控制器以及对headere.phtml的操作

logic is like for magento customer dasboard page url is customer/account/index 逻辑就像是magento客户dasboard页面url是客户/帐户/索引

then 
<?php $action = Mage::app()->getFrontController()->getAction();
echo $action->getFullActionName('_');
if($action->getFullActionName('_')=="customer_account_index")
{

}

?>

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

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