艾伦·斯托姆《helloworld》 config.xml 文件
我在学习本教程时遇到问题。下面是我的配置文件。我的前端部分是否位于正确的位置?我似乎无法让它发挥作用。我访问了我的网站 /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/controllers/IndexController.php:
class Alanstormdotcom_Helloworld_IndexController extends Mage_Core_Controller_Front_Action {
public function indexAction() {
echo 'Hello Index!';
}
}
应用程序/etc/modules/Alanstormdotcom_Helloworld.xml
<config>
<modules>
<Alanstormdotcom_Helloworld>
<active>true</active>
<codePool>local</codePool>
</Alanstormdotcom_Helloworld>
</modules>
</config>
I am having trouble following this tutorial. Below is my configuration file. Do I have the frontend section in the correct place? I can't seem to get this to work. I got to my site /helloworld/index/index
, and nothing happens. What is supposed to happen?
app/code/local/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>
app/code/local/Alanstormdotcom/Helloworld/controllers/IndexController.php:
class Alanstormdotcom_Helloworld_IndexController extends Mage_Core_Controller_Front_Action {
public function indexAction() {
echo 'Hello Index!';
}
}
app/etc/modules/Alanstormdotcom_Helloworld.xml
<config>
<modules>
<Alanstormdotcom_Helloworld>
<active>true</active>
<codePool>local</codePool>
</Alanstormdotcom_Helloworld>
</modules>
</config>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您正在运行什么版本的 Magento?除了缓存问题之外,我不确定还有什么问题。我已经获取了你的文件,它们在 1.4.0.1 上工作得很好(除了你的 config.xml 路径中的拼写错误,除非那不是拼写错误)
这是我所做的工作:
app/code/local/Alanstormdotcom/Helloworld/ etc/config.xml:
app/code/local/Alanstormdotcom/Helloworld/controllers/IndexController.php
app/etc/modules/Alanstormdotcom_Helloworld.xml
所以是的,基本上是同一件事......您尝试过完全关闭缓存吗?
What version of Magento are you running? I'm not sure whats wrong other then a cache issue. I have taken your files and they work great on 1.4.0.1 (other then the typo in the path to your config.xml unless thats not a typo)
Here is what I have that worked:
app/code/local/Alanstormdotcom/Helloworld/etc/config.xml:
app/code/local/Alanstormdotcom/Helloworld/controllers/IndexController.php
app/etc/modules/Alanstormdotcom_Helloworld.xml
Soo yeah basically the same thing ... have you tried turning cache completely off?
您可以尝试两种解决方案:
1)刷新 Magento 的缓存并尝试重新加载页面
2)更改标签正下方的标签(并刷新缓存)
You could try two solutions:
1) refresh the cache of Magento and try to reload the page
2) change the tag right below tag with (and refresh your cache)