Steps:
1. Create a Hello World module
2. Configure routing for this module
3. Create an execution controller for this module
Creating the Hello World module
To create a structure directory for a module:
App/core/local/sjolzy/helloworld/block
App/core/local/sjolzy/helloworld/controllers
App/core/local/sjolzy/helloworld/etc
App/core/local/sjolzy/helloworld/helper
App/core/local/sjolzy/helloworld/model
App/core/local/sjolzy/helloworld/sql
To create the content of CONFIG. App/core/local/sjolzy/helloworld/etc/config.xml:
<config>
<modules>
<Sjolzy_HelloWorld>
<version>0.1.0</version>
</Sjolzy_HelloWorld>
</modules>
</config>
Then create a system configuration file to activate this module
Sjolzy_helloworld.xml (App/etc/modules/sjolzy_helloworld.xml)
<config>
<modules>
<Sjolzy_HelloWorld>
<active>true</active>
<codePool>local</codePool>
</Sjolzy_HelloWorld>
</modules>
</config>
Check whether the module is activated: Empty the Magento Cache first (Var/cache), manage in the background: system->configuration->advanced expand disable Modules Output to see if Sjolzy _helloworld show up.
Configure Routing
Routing is used to convert a URL request into a method of executing a controller.
You need to explicitly define your route in the global configuration of Magento.
in CONFIG. app/core/local/sjolzy/helloworld/etc/config.xml:
<config>
...
<!--/* Fontend: The front desk to the website (or admin|install) */-
<frontend>
<!--/* Routers: Definition of route object or definition of routing path */-
<routers>
<!--/* HelloWorld: The front desk pointing to the website *-and
<use>standard</use>
<args>
<!--/* module: Lower-case version of the block name */-
<module>Sjolzy_HelloWorld</module>
<!--/* FontName: A parameter in the routing process that is only relevant to the route (Front controller is used to instantiate all routes) */-
<frontName>helloworld</frontName>
</args>
</routers>
</frontend>
</config>
To create an execution controller for a route
Routing will give control to the controller, we have defined the route, and now we define our execution controller.
App/code/local/sjolzy/helloworld/controllers/indexaction.php (the controller of the module is placed in the sub-directory controllers< lowercase >, which is the Magento rule)
<?php
Class Sjolzy_helloworld_indexcontroller extends mage_core_controller_front_action{
Public Function indexaction () {
Echo ' Hello world! ';
}
}
?>
Or the situation cache, request Url:http://example.com/helloworld/index/index
Note: http://example.com/frontName/execution controller/execution method
If you see a blank page that says ' Hello world! ', your module is created successfully!
How to create a Magento module Z's Hello World example (RPM)