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.
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.
精彩评论