Model-View-Controller Component - Part 2 - Adding a Model
Model-View-Controller Component - Part 2 - Adding a Model Introduction In the first tutorial of this series, creating a simple view-controller component using the Joomla! 1.5 CMS framework was demonstrated. In the first tutorial, the greeting was hardcoded into the view. This doesn’t follow the MVC pattern exactly because the view is intended to only display the data, and not contain it. In this second part of the tutorial we will demonstrate how to move this out of the view and into a model. In future tutorials we will demonstrate the power and flexibility that this design pattern provides. Creating the Model The concept of model gets its name because this class is intended to represent (or ‘model’) some entity. In our case, our first model will represent a ‘hello’, or a greeting. This is in line with our design thus far, because we have one view (’hello’), which is a view of our greeting. The naming convention for models in the Joomla! framework is that the class name starts with the...













Nhận xét
Đăng nhận xét