The Model View Controller (MVC) is a methodology for separating web components into respective subrogated categories of Model, View and Controller. The model usually contains the business logic for information management. The view component handles the details of delivering the prepared content to the end user in the form of a web page. The controller component functions as a traffic cop for the respective end user view.
In CodeIgniter there are those times when a page may have several personalities to accomplish a certain function. In our example today a workbench for published articles is our targeted subject. The associated software tool would identify how the articles are housed, maintained and delivered to the end user. The first personality would be to list all the possible categories of articles. The second incarnation would prepare and manage all the articles associated with a particular category. The final representation would allow the user to view the articles content.
The overall desired effect is achieved by an action parameter as the third portion of the URI. These action parameters have valid values of “listcats”, “listarts”, and “viewarts” (minus double quotes) which correspond to the designed functionality. A fourth portion of the URI is also employed that in the case of the “listcats” option supplies the designated category. When the fourth portion of the URI is employed with the “viewart” action parameter it refers to the record number of the selected article. The balance of the desired affect is accomplished by using various queries and presenting associated views of the information to the user.
When the user clicks on the desired category a list of all associated articles appears. The user may at this point select any article of interest. The article will then appear and the user will have the option to review other articles in this category or to view all the available articles. This feature allows the user to peruse other articles in this category before continuing to view articles from other categories.
A drill down approach to managing articles in this manner is a perfectly acceptable way for the user to interact with the CodeIgniter application. Web site page bloat (having excessive web pages to accomplish a desired functionality) is kept to a minimum with this type of mechanism.
