这段 Magento 代码有什么问题? - 简单的例子
我正在尝试按照以下网址遵循这个非常流行的教程: http://alanstorm.com/magento_admin_controllers
我尝试了第一次测试 - 在“测试它”下,我没有被重定向到登录屏幕,然后重定向到带有空白页面的控制面板。相反,我得到了...
对网址 http://mymagentotest.com/index.php/adminhelloworld/ 的响应 产生以下消息。我一遍又一遍地尝试,每次都得到完全相同的结果 - 这告诉我,我正在通过一遍又一遍地犯同样的错误来学习如何做错。我需要帮助,或者我们需要帮助,因为我确信我不是唯一的人。
哎呀,我们的坏...您的页面 找不到所请求的,我们有一个 很好猜为什么。如果您输入了 URL 直接,请确保 拼写正确。如果您点击 到达这里的链接,链接是 已经过时了。
我看不出出了什么问题,就我有限的知识而言,一切看起来都很好,我不得不猜测配置文件的结构。我认为这就是问题所在。这是我的代码....
app/code/local/Alanstormdotcom/Adminhelloworld/etc
中的配置文件...
<config>
<!-- ... -->
<admin>
<routers>
<the_name_of_this_element_is_not_important_it_should_be_unique>
<use>admin</use>
<args>
<module>Alanstormdotcom_Adminhelloworld</module>
<frontName>adminhelloworld</frontName>
</args>
</the_name_of_this_element_is_not_important_it_should_be_unique>
</routers>
</admin>
<!-- ... -->
</config>
app/code/local/Alanstormdotcom/Adminhelloworld/中的索引控制器
app/etc/modules
中的
<?php class Alanstormdotcom_Adminhelloworld_IndexController extends Mage_Adminhtml_Controller_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
Alanstormdotcom_adminHelloworld.xml ..
<config>
<modules>
<Alanstormdotcom_Adminhelloworld>
<version>0.1.0</version>
</Alanstormdotcom_Adminhelloworld>
</modules>
</config>
签名:困惑,感觉注定失败。为了我的工作,我必须努力学习这些东西,如果我失败了,我最终会住在巷子里的一个漂亮的盒子里。
I am trying to follow this very popular tutorial at this url: http://alanstorm.com/magento_admin_controllers
I tried the very first test - under "Testing It Out" I did not get redirected to my log in screen and then to the control panel with a blank page. Instead I got ...
Response to the url http://mymagentotest.com/index.php/adminhelloworld/ produces the message below. I tried this over and over, I get the exact same results every time - which tells me that I'm learning how to do it WRONG by my making the same mistake over and over again. I need help, or we need help because I'm sure I'm not the only one.
Whoops, our bad... The page you
requested was not found, and we have a
fine guess why. If you typed the URL
directly, please make sure the
spelling is correct. If you clicked on
a link to get here, the link is
outdated.
I cannot see what is wrong, everything looks fine to the best of my limited knowledge, I had to guess the structure of the config file. I think that's where the issue is. Here is my code ....
The config file in app/code/local/Alanstormdotcom/Adminhelloworld/etc
...
<config>
<!-- ... -->
<admin>
<routers>
<the_name_of_this_element_is_not_important_it_should_be_unique>
<use>admin</use>
<args>
<module>Alanstormdotcom_Adminhelloworld</module>
<frontName>adminhelloworld</frontName>
</args>
</the_name_of_this_element_is_not_important_it_should_be_unique>
</routers>
</admin>
<!-- ... -->
</config>
The index controller in app/code/local/Alanstormdotcom/Adminhelloworld/controllers
<?php class Alanstormdotcom_Adminhelloworld_IndexController extends Mage_Adminhtml_Controller_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
Alanstormdotcom_adminHelloworld.xml
in app/etc/modules
..
<config>
<modules>
<Alanstormdotcom_Adminhelloworld>
<version>0.1.0</version>
</Alanstormdotcom_Adminhelloworld>
</modules>
</config>
Signed: Baffled, and feeling doomed. I have to try to learn this stuff, for my job, which if I fail, I end up living in a nice box in an alley.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常,您拥有的两部分 XML 应合并到
app/code/local/Alanstormdotcom/Adminhelloworld/etc/config.xml
和第二个文件app/etc/modules/Alanstormdotcom_adminHelloworld。 xml
,看起来像这样:虽然对于新手来说这似乎是一个巨大的艰苦斗争,但你要么掌握它并变得更有就业能力,要么学习使用像 ModuleCreator。无论发生什么,你都会回顾过去,想知道自己曾经是如何挣扎的。
Typically the two bits of XML you have should be combined into
app/code/local/Alanstormdotcom/Adminhelloworld/etc/config.xml
and the second file,app/etc/modules/Alanstormdotcom_adminHelloworld.xml
, would instead look like this:While it might seem like a massive uphill struggle to the newcomer you'll either get the hang of it and become much more employable or learn to use automation tools like ModuleCreator. Whichever happens you'll look back and wonder how you ever struggled.