Joomla MVC: How to Implement MVC Pattern in Joomla?Tag: joomla, MVC, component, module, pattern Category: PHP Frameworkpost: 10 Jan 2008 read: 3,214 Joomla MVC Step by Step Tutorial: We have known Model View Controller (MVC) at previous tutorial. In this post, we will learn more how to apply MVC in Joomla conceptually. We must understand it before write line codes. How structure file when use MVC? We still use hello component as study case. You can read about creating Hello Joomla Component in this site for refreshing before read this. Are you ready? First, we glance over following structure file:
Model We must create a folder named models. We know, model task connecting with data access. We will create 2 file: all and individual display. All means show all data/more than one data in a screen. Individual display means just one data will display according id that we choose. Create two file named "all.php" for fetch list data from table and "hello.php" for single data.
View As we know, the task of View is extracts data and formats it for presentation. For this job, we need structure file model like following screen:
Within all folder, created file named "view.html.php". Do it again within hello folder. Next, in each tmpl folder, created file named "default.php". So we get following structure:
Controller We just need a file for this job. Create file named "controller.php" within components/com_hello/. Hope this post help you. |
| | Give Your Opinion | Recommend |
|

