Magento - check if cms page

前端 未结 1 1817
感情败类
感情败类 2021-02-14 16:35

i want to check via php if a page is a cms_page in Magento. I need diffrent breadcrumbs for cms pages, so im trying to this with a condition, but i have no idea how to or where

1条回答
  •  梦毁少年i
    2021-02-14 17:30

    The following should give you what you want

    //from a block or phtml script
    $this->getRequest()->getModuleName()
    

    When this returns the string 'cms', you're on a CMS page.

    When Magento's frontend and admin routers can't find a match on your URL, the CMS router takes over. If the CMS router finds a match (based on the CMS pages you've setup), it hands off the request to the cms module and Mage_Cms_IndexController controller.

    0 讨论(0)
提交回复
热议问题