Book Image

Programming with CodeIgniter MVC

Book Image

Programming with CodeIgniter MVC

Overview of this book

The CodeIgniter Model-View-Controller framework provides genius simplicity, flexibility, and efficient resource usage, boosting performance and reusability. "Programming with CodeIgniter MVC" reviews the unique features of CodeIgniter using simple, easy-to-follow, and practical examples. Programming with CodeIgniter MVC provides a simple step-by-step guide to efficiently utilizingthe CodeIgniter MVC framework for developing web applications. This book is packed with engaging examples to understand the usage of controllers, libraries, and (Codeigniter) CI Models. This book commences with a quick discussion of the CodeIgniter Integration with  external plugins such as Flickr API, Google Maps and more will be reviewed with clear usage examples. It will then cover CI naming convention rules, mandatory and optional configurations, and usage within a CI project. It will also cover user defined configurations. By the end of this book, you will not only understand user-defined libraries in a CI framework, but also their services, role, usage, and scope with the help of an example-based approach. The book also covers helpers, models, and views, as well as their usage. Using this book, youwill soonbe able to develop feature-rich web applications using the CodeIgniter MVC framework. "Programming with CodeIgniter MVC" is a one-stop solution to developing solutions with CodeIgniter MVC.
Table of Contents (15 chapters)
Programming with CodeIgniter MVC
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Appendix
Index

Folders overview


The root folder contains the index.php file, which handles all the URI requests. The index.php file will process them with the CI core, and apply our application controllers using the models, libraries, and helpers loaded by the controllers and rendered views, license.txt, which is the CI's license file. .htaccess is used for configuring the CI routing and removing index.php from the URL. JavaScript, CSS, and HTML is incorporated into the rendered PHP output and their usage is elaborated in Chapter 7, Views.

Let's review the folders and their content application.

The application directory folder is the root directory of our main activity project coding zone. This is the heart of the CI-developed application project.

Mandatory components

Let's take a look at the mandatory components.

  • application/config: This folder contains all the CI application configuration files, which are covered in Chapter 2, Configurations and Naming Conventions.

  • application/controllers: This folder contains all the application controllers in the CI application project. A controller, as mentioned in the Preface, is a component in the MVC-design architecture that handles the request by the user and presents the data shown to the user. A controller in CI is a class extending a base class of the CI controller. The class methods can be executed or called with a proper URI. The naming conventions related to the controller definition and usage will be covered in Chapter 2, Configurations and Naming Conventions.

  • application/views: This folder contains all the view files. A view is the HTML content executed by the user browser that presents and interacts with the user. A view can be a webpage or an RSS page.

The following components are not mandatory but are highly recommended:

  • application/models: This folder contains all the project model files. A model is the component of the MVC design architecture, which handles the data stored in the database. A model in CI is a PHP class that is designed to work with the information in the database. Chapter 6, Models, will elaborate on the CI models concept, definition, and usage with several usage examples.

  • application/helpers: This folder contains all the additional helper files to the CI helpers. They can be third-party or created by the developer. A helper file is a collection of independent procedural functions in a particular category. Each helper function performs one specific task, with no dependence on other functions. Chapter 5, Helpers, will elaborate on the CI helpers concept, definition, and usage with several usage examples.

  • application/libraries: This folder contains all the libraries of the CI application project created by the developer. A CI library is technically a PHP class. The scope of the library can be any project resource, such as helpers, models, controllers, and views. For example, a library can provide Facebook library API services to simplify the application code for Facebook integration. Chapter 4, Libraries, will elaborate on the CI libraries concept, definition, and usage with several usage examples.

  • system: This is the root of the CodeIgniter core directory. The system folder contains important system components in the subfolders, such as core, database, helpers (built-in system helpers), and libraries (built-in system libraries).

    Tip

    Do not edit any of these files! Upgrading is much easier if we don't.