按照以下步骤,我仍然看不到它的工作原理:
http://alanstorm.com/magento_admin_controllers
这仍然适用于最新版本的Magento,还是该教程过时了?
还有什么可能导致404错误出现吗?
配置文件:
<config>
<modules>
<Alanstormdotcom_Adminhelloworld>
<version>0.1.0</version>
</Alanstormdotcom_Adminhelloworld>
</modules>
<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>
<adminhtml>
<menu>
<tutorial_menu translate="title" module="adminhelloworld">
<title>Tutorial Menu</title>
<sort_order>9999</sort_order>
<children>
<first_page module="adminhelloworld">
<title>Our First Page</title>
<action>adminhelloworld/index/index</action>
</first_page>
</children>
</tutorial_menu>
<system>
<children>
<another_menu_from_us>
<title>Here Too!</title>
<action>adminhelloworld/index/index</action>
</another_menu_from_us>
</children>
</system>
</menu>
</adminhtml>
<global>
<helpers>
<adminhelloworld>
<class>Alanstormdotcom_Adminhelloworld_Helper</class>
</adminhelloworld>
</helpers>
</global>
索引控制器:
类Alanstormdotcom_Adminhelloworld_IndexController扩展Mage_Adminhtml_Controller_Action { 公共函数indexAction() { $这 - &GT; loadLayout();
//create a text block with the name of "example-block"
$block = $this->getLayout()
->createBlock('core/text', 'example-block')
->setText('<h1>This is a text block</h1>');
$this->_addContent($block);
$this->renderLayout();
} 受保护的函数_addContent(Mage_Core_Block_Abstract $ block) { $这 - &GT; getLayout() - &GT; getBlock( '内容') - &GT;附加($块); 返回$ this; } }
答案 0 :(得分:0)
我终于开始工作......
代码示例中有一些缺少打开的php标记,但最重要的部分是清除所有正确的缓存,然后正确的东西开始显示!
永远记住缓存部分!
希望这有助于某人