没有在magento加载控制器,为什么?

时间:2013-10-03 16:29:31

标签: magento

config.xml中

<?xml version="1.0"?>
        <config>
            <modules>
                <Asgard_New>
                    <version>1.6.0.0</version>
                </Asgard_New>
            </modules>
            <global>
                <models>
                    <asgardnew>
                        <class>Asgard_New_Model</class>
                    </asgardnew>
                </models>
                <helpers>
                    <asgardnew>
                        <class>Asgard_New_Helper</class>
                    </asgardnew>
                </helpers>
            </global>
            <frontend>
                <routers>
                    <asgardnew>
                        <use>standard</use>
                        <args>
                            <module>Asgard_New</module>
                            <frontName>new</frontName>
                        </args>
                    </asgardnew>
                </routers>
            </frontend>
    </config>

Asgard_New.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Asgard_New>
            <active>true</active>
            <codePool>local</codePool>
        </Asgard_New>
    </modules>
</config>

IndexController.php

<?php
class Asgard_New_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
        echo "Hello, magento!!";
    }
    public function helloAction()
    {
        echo "Hello, action!!";
    }
    public function layoutAction()
    {
        $xml = $this->loadLayout()->getLayout()->getUpdate()->asString();
        $this->getResponse()->setHeader("Content-Type", "text/plain")->setBody($xml);
        Mage::log($xml, Zend_Log::INFO, 'layout_log', true);
    }
    public function defaultAction()
    {
        $this->loadLayout()->renderLayout();
    }
}
?>

模数 - &gt; local / Asgard我有相同代码的文件夹Test ans New

http://magento/test/index/index
http://magento/new/index/index

不工作,最近两天工作,但今天我尝试创建一个自己的包和主题,这是停止工作。伙计们为什么会这样?谢谢!

1 个答案:

答案 0 :(得分:1)

尝试用新的

替换asgardnew
<frontend>
    <routers>
        <new>
            <use>standard</use>
            <args>
                <module>Asgard_New</module>
                <frontName>new</frontName>
            </args>
        </new>
    </routers>
 </frontend>