Alan Storm“helloworld”config.xml文件

时间:2011-05-02 19:00:43

标签: magento

我在阅读本教程时遇到了问题。以下是我的配置文件。我是否在正确的位置安装了前端部分?我似乎无法让这个工作。我到了我的网站/helloworld/index/index,没有任何反应。应该发生什么?

应用程序/代码/本地/ Alanstormdotcom / Hellowowrld的/ etc / config.xml中:

<config>    
    <modules>
        <Alanstormdotcom_Helloworld>
            <version>0.1.0</version>
        </Alanstormdotcom_Helloworld>
    </modules>
<frontend>
        <routers>
            <helloworld>
                <use>standard</use>
                <args>
                    <module>Alanstormdotcom_Helloworld</module>
                    <frontName>helloworld</frontName>
                </args>
            </helloworld>
        </routers>  
    </frontend>

</config>   

应用程序/代码/本地/ Alanstormdotcom /的Helloworld /控制器/ IndexController.php:

class Alanstormdotcom_Helloworld_IndexController extends Mage_Core_Controller_Front_Action {        
    public function indexAction() {
        echo 'Hello Index!';
    }
}

应用程序的/ etc /模块/ Alanstormdotcom_Helloworld.xml

<config>
    <modules>
        <Alanstormdotcom_Helloworld>
            <active>true</active>
            <codePool>local</codePool>
        </Alanstormdotcom_Helloworld>
    </modules>
</config>       

2 个答案:

答案 0 :(得分:2)

你在运行什么版本的Magento?我不确定除了缓存问题之外什么是错的。我已经获取了你的文件并且它们在1.4.0.1上工作得很好(除了那个在你的config.xml之路上的拼写错误,除非那不是拼写错误)

这就是我的工作:

应用程序/代码/本地/ Alanstormdotcom /的Helloworld的/ etc / config.xml中:

<?xml version="1.0"?>
<config>
    <modules>
        <Alanstormdotcom_Helloworld>
            <version>0.1.0</version>
        </Alanstormdotcom_Helloworld>
    </modules>
    <frontend>
        <routers>
            <helloworld>
                <use>standard</use>
                <args>
                    <module>Alanstormdotcom_Helloworld</module>
                    <frontName>helloworld</frontName>
                </args>
            </helloworld>
        </routers>
    </frontend>
</config>

应用程序/代码/本地/ Alanstormdotcom /的Helloworld /控制器/ IndexController.php

<?php

class Alanstormdotcom_Helloworld_IndexController extends Mage_Core_Controller_Front_Action {
    public function indexAction() {
        echo 'Hello Index!';
    }
}

应用程序的/ etc /模块/ Alanstormdotcom_Helloworld.xml

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

Soo是的,基本上是一样的...你试过完全关闭缓存吗?

答案 1 :(得分:0)

您可以尝试两种解决方案:

1)刷新Magento的缓存并尝试重新加载页面

2)更改标签下方的标签(并刷新缓存)