5. Common Functions
• CodeIgniter uses a few functions for its operation that
are globally defined, and are available to you at any
point. These do not require loading any libraries or
helpers.
– is_php('version_number')
– is_really_writable('path/to/file')
– config_item('item_key')
– show_error('message')
– show_404('page')
– log_message('level', 'message')
• error
• debug
• Info
7. URI Routing
• Typically there is a one-to-one relationship
between a URL string and its corresponding
controller class/method.
$route['journals'] = "blogs";
$route['blog/joe'] = "blogs/users/34";
$route['product/(:any)'] = "catalog/product_lookup";
$route['product/(:num)'] = "catalog/product_lookup_by_id/$1”;
9. Error Handling
• CodeIgniter lets you build error reporting into
your applications using the functions described
below. In addition, it has an error logging class
that permits error and debugging messages to be
saved as text files.
– show_error('message' [, int $status_code= 500 ] )
– show_404('page' [, 'log_error'])
– log_message('level', 'message')
• error
• debug
• Info
10. Caching
• CodeIgniter lets you cache your pages in order
to achieve maximum performance.
$this->output->cache(n);
12. Profiling CodeIgniter Application
• The Profiler Class will display benchmark
results, queries you have run, and $_POST
data at the bottom of your pages. This
information can be useful during development
in order to help with debugging and
optimization.
$this->output->enable_profiler(TRUE);
13. Profiling CodeIgniter Application
• Each section of Profiler data can be enabled or
disabled by setting a corresponding config
variable to TRUE or FALSE.
• Override in Controller
$config['config'] = FALSE;
$config['queries'] = FALSE;
$sections = array(
'config' => TRUE,
'queries' => TRUE
);
$this->output->set_profiler_sections($sections);