无法在我的自定义模块 Magento 中扩展 Mage_Cms_IndexController

Not able to extend Mage_Cms_IndexController in my custom module, Magento

我正在尝试扩展 Mage_Cms_IndexController 控制器,但没有任何反应。我的代码在 app/code/local/Ash/Test .

app/code/local/Ash/Test/etc/config.xml

的代码
 <frontend>
    <routers>
        <ash_test>
            <use>standard</use>
            <args>
                <module>Ash_Test</module>
                <frontName>ash_test</frontName>                 
            </args>
        </ash_test>
        <cms>
            <args>                    
                <modules>
                    <Ash_Test before="Mage_Cms">
                        Ash_Test_Frontend_Cms
                    </Ash_Test>
                </modules>
            </args>
        </cms>
    </routers>
</frontend>

我模块中的控制器位置是

app/code/local/Ash/Test/controllers/Frontend/Cms/IndexController

代码是

 require_once Mage::getModuleDir('controllers', 'Mage_Cms').DS.'IndexController.php';
class Ash_Test_Frontend_Cms_IndexController extends Mage_Cms_IndexController
{

public function indexAction($coreRoute = null)
    {
        echo __FILE__;

    }
}

我不明白其中有什么问题。请帮忙!

删除以下代码周围的白色 space,

<Ash_Test before="Mage_Cms">
    Ash_Test_Frontend_Cms
</Ash_Test>

应该是这样的,

<Ash_Test before="Mage_Cms">Ash_Test_Frontend_Cms</Ash_Test>

刷新缓存然后检查。它应该有效。

You cannot have any whitespace around your controller name in config.xml. Magento will silently fail to pick up your override and just use the controller from the core.