magento获取判断当前页或句柄handles的语法

magento获取判断当前页或句柄handles的语法

magento获取判断当前页或句柄handles是在magento操作过程中会遇到的,

产品页 catalog_product_view
目录页 catalog_category_view
主页 cms_index_index
site map页 catalog_seo_sitemap_category
注册页 customer_account_login
判断这些页为我们在代码中进一步控制一些行为提供方便,
那到底如何才通获得当前页的,语法如下:
$this->getRequest()->getRequestedRouteName().’_’.$this->getRequest()->getRequestedControllerName().’_’.$this->getRequest()->getRequestedActionName();

$this->getRequest()->getRouteName().’_’.$this->getRequest()->getControllerName().’_’.$this->getRequest()->getActionName();
两种都可以使用,输出的内容是一样的!
不知是还有有更好的方法.


你可能感兴趣的:(magento获取判断当前页或句柄handles的语法)