只看 Magento 1.9 中的 url 如何知道一个 frontname 属于哪个模块?

how to know which module a frontname belongs to just looking at the url in Magento 1.9?

例如: url 是

index.php/catalogsearch/advanced/

如何找出它属于哪个模块?在这种情况下,我知道 frontname 是 "catalogsearch",控制器是 "advanced",方法是 "indexAction"?但是它属于哪个模块?

在这种情况下很容易,因为 frontname 的名称和模块的名称匹配,但如果它们不同呢?我们如何找到 frontname 的模块?

答案在这里,在模块 Mage_CatalogSearch 的 config.xml 文件中:

<routers>
        <catalogsearch>
            <use>standard</use>
            <args>
                <module>Mage_CatalogSearch</module>
                <frontName>catalogsearch</frontName>
            </args>
        </catalogsearch>
 </routers>

所以我希望您有一个好的 IDE 可以让您对所有文件执行搜索。如果您无法执行搜索,您可以编辑您要搜索的 URL 页面中使用的模板,并将其转储到日志文件中:

Mage::app()->getRequest()->getControllerModule();

这会给你 "Mage_CatalogSearch"。另外,您可能也想使用这些方法:

Mage::app()->getRequest()->getControllerName();
Mage::app()->getRequest()->getActionName();

//在 index.php 文件或任何 phtml 文件中写入以下代码。

/**
 * get module name
 */
$this->getRequest()->getModuleName();

More details got through the this link.