用户登录后主页面的左侧菜单高亮显示

用户登录后主页面左侧菜单高亮显示,如下所示:
[img]http://dl.iteye.com/upload/attachment/239294/a7deba47-2371-3e77-b2af-e18768fb5cac.jpg[/img]

该实现一切归功于内置的Block: customer/account_navigation.
在layout文件(customer.xml)中,有如下声明:

<customer_account translate="label">
<reference name="left">
<block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml">
<action method="addLink" translate="label" module="customer">
<name>account</name>
<path>customer/account/</path>
<label>Account Dashboard</label>
</action>
<action method="addLink" translate="label" module="customer">
<name>account_edit</name>
<path>customer/account/edit/</path>
<label>Account Information</label>
</action>
<action method="addLink" translate="label" module="customer">
<name>address_book</name>
<path>customer/address/</path>
<label>Address Book</label>
</action>
</block>
...
</reference>
...
</customer_account>

以上三个action标签声明了左侧三个菜单项,每当点击链接进入action的path对应的页面,自动会将该项设置为高亮。

现在进入某页面(引用了navigation) mycustomer/address后,希望能将高亮显示到前述菜单的Address Book项(链接为customer/address),则需要在controller的action方法中明确指定将其激活
if ($navigationBlock = $this->getLayout()->getBlock('customer_account_navigation')){
$navigationBlock->setActive('customer/address');
}


看看现在有什么变化?
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值