创建一个模块helloworld magento

时间:2013-01-20 10:29:04

标签: magento

我按照http://alanstorm.com/magento_controller_hello_world中的教程进行操作 但我不知道为什么链接filipeferminiano.com/lojateste/helloworld不起作用。 这是我的config.xml

<config>    
<modules>
    <ffdotcom_Helloworld>
        <version>0.1.0</version>
    </ffdotcom_Helloworld>
</modules> <frontend>
    <routers>
        <helloworld>
            <use>standard</use>
            <args>
                <module>ffdotcom_Helloworld</module>
                <frontName>helloworld</frontName>
            </args>
        </helloworld>
    </routers>  
</frontend>

2 个答案:

答案 0 :(得分:2)

创建:app / code / local / Ffdotcom / Helloworld / etc / config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Ffdotcom_Helloworld>
        <version>1.0.0</version>
    </Ffdotcom_Helloworld>    
  </modules>
  <frontend>
    <routers>
        <helloworld>
            <use>standard</use>
            <args>
                <module>Ffdotcom_Helloworld</module>
                <frontName>helloworld</frontName>
            </args>
        </helloworld>
    </routers>  
  </frontend>
 </config>

创建:app / code / local / Ffdotcom / Helloworld / controllers / IndexController.php

<?php
class Ffdotcom_Helloworld_IndexController extends Mage_Core_Controller_Front_Action
{

    public function indexAction(){
        echo 'hello world';
    }

}

创建:app / etc / modules / Ffdotcom_Helloworld.xml

<?xml version="1.0"?>
<config>
   <modules>
       <Ffdotcom_Helloworld>
            <active>true</active>
            <codePool>local</codePool>
       </Ffdotcom_Helloworld>
   </modules>
</config>

答案 1 :(得分:1)

模块名称​​中的第一个“f”必须frontend/routers/helloworld/args xpath中大写。

相关问题