backup_cdi - SPLessons

CodeIgniter Helpers

Home > Lesson > Chapter 7
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

CodeIgniter Helpers

CodeIgniter Helpers

Helpers are the collection of functions. Each helper is used in different ways like url , anchor, array and etc. By making user of these CodeIgniter helpers we can optimize the coding instead writing the lengthy codes. Syntax: [php] $this->load->helper('name'); [/php] We can load the any helper making user of above statement. Here name is the helper name which we want to load like below. [php] $this->load->helper('url'); [/php] We have another helper called 'anchor' , this will use in navigation. [php] echo anchor('controllername/methodname, 'Click Here'); echo anchor(My_Controller/MyMenthod, 'Click Here'); [/php] One more helper is 'file', by using this we can read the files. [php] $this->load->helper('file'); [/php] Array Helper [php] $array_Fruits= array( '1' => 'apple', '2' => 'Mango, '3' => 'Orange') [/php] We have many more helpers in CodeIgniter, that you will learn in coming lessons.