Book Image

CodeIgniter Web Application Blueprints

Book Image

CodeIgniter Web Application Blueprints

Overview of this book

Table of Contents (16 chapters)
CodeIgniter Web Application Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating the controllers


We're going to create three controllers for this application. These are as follows:

  • discussions.php: This fetches discussions from the discussions table in the database and allows the user to create a new discussion

  • comments.php: This fetches comments from the comments table in the database and allows the user to join a discussion by adding a comment to a discussion forum

  • admin.php: This contains basic admin functions, login functionalities, and moderation options

The discussions controller

The discussions.php controller is responsible for the display of all valid discussions, processing the creation of new discussions and flagging any discussion for moderation. The discussions controller contains three functions, and these are as follows:

  • index(): This displays all valid discussions

  • create(): This creates a new discussion, handling any form validation

  • flag(): This processes a discussion for moderation by calling the flag() function of discussions_model.php, setting...