Tuesday, May 29, 2012

How to create a simple "Hello World" module in Magento?

How can the following be accomplish in Magento?

  • Display a "Hello World" message using a controller/view/model approach. So, if I went to http://mysite.com/myController it would show the string 'Hello World'. Being able to show this string within the template of my website (for example, the header, footer, etc.) will be a bonus.

  • How to add a method to this controller (or a new controller if necessary), which interacts with a model, and performs the query Select * FROM articles where id='10' and returns the row (containing the columns id, title, content ) to the controller? And then use the controller to include a view, which would display this row. So going to http://site.com/myController/show_row (or something similar) would display the row within a view. (No need to be fancy, just a echo $row->id; or something similar would work.)

Any other information about Magento's code structure will also be very helpful.

Source: Tips4all

No comments:

Post a Comment