这段 Magento 代码有什么问题? - 简单的例子

发布于 2024-10-31 10:01:31 字数 2045 浏览 0 评论 0原文

我正在尝试按照以下网址遵循这个非常流行的教程: 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鹿! 2024-11-07 10:01:31

通常,您拥有的两部分 XML 应合并到 app/code/local/Alanstormdotcom/Adminhelloworld/etc/config.xml 和第二个文件 app/etc/modules/Alanstormdotcom_adminHelloworld。 xml,看起来像这样:

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

虽然对于新手来说这似乎是一个巨大的艰苦斗争,但你要么掌握它并变得更有就业能力,要么学习使用像 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:

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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文