Skip to main content

Posts

Showing posts from November, 2017

Simple CodeIgniter Tutorial

This Simple tutorial will primarily focus on: Model-View-Controller basics Routing basics Form validation Performing basic database queries using “Query Builder” Adding logic to the controller : Create a file at application-package_folder/controllers/Pages.php with the following code. <?php class Pages extends CI_Controller { public function view($page = 'home') { } } You have created a class named Pages , with a view method that accepts one argument named $page . The Pages class is extending the CI_Controller class. This means that the new pages class can access the methods and variables defined in the CI_Controller class ( system/core/Controller.php ). The controller is what will become the center of every request to your web application. In very technical CodeIgniter discussions, it may be referred to as the super object . Like any php class, you refer to it within your controllers as $this . Referring to $this i...

CodeIgniter Overview

The first step is to install CodeIgniter, then read all the topics in the Introduction section of the Table of Contents. Next, read each of the General Topics pages in order. Each topic builds on the previous one, and includes code examples that you are encouraged to try. CodeIgniter Directory Structure: General Topics:     CodeIgniter URLs     Controllers     Reserved Names     Views     Models     Helpers     Using CodeIgniter Libraries     Creating Libraries     Using CodeIgniter Drivers     Creating Drivers     Creating Core System Classes     Creating Ancillary Classes     Hooks - Extending the Framework Core     Auto-loading Resources     Common Functions     Compatibility Functions     URI Routing ...

How to install CodeIgniter

How to install CodeIgniter Download CodeIgniter : Click here:  Configuring the base URL: Open the config.php file located in application/config/config.php directory Look for the line that says $config['base_url'] = ''; If the base_url is blank, CodeIgniter will try to guess the root URL but this is not guaranteed to always work so it’s better to explicitly set it. Enter our project URL as shown below $config['base_url'] = 'http://localhost/package_name/'; HERE, “'http://localhost/package_name/'” will be returned when you call the base URL helper function. We will talk more about the base URL later. Removing the index.php segment from the URLs Configuring the database connection parameters: This section assumes you have a working MySQL installation, password security has been enforced and you have a database already created in MySQL. Open the database.php file located in application/config/database.php directory Look f...