Top codeigniter interview question and answers

codeigniter interview question

 What is codeigniter?
Codeigniter is open source , web application framework.Its is for building websites using php.Codeigniter is loosely based on MVC pattern.Most simple framework in php , which is you will easily learn.Its mostly known for its speed as compare to other frameworks in php.
Its goal is to enable you to develop projects much faster than you could if you were writing code from scratch, by providing a rich set of libraries for commonly needed tasks, as well as a simple interface and logical structure to access these libraries.

 When and who developed codeigniter?
The first public version of CodeIgniter was released on February 28, 2006.

 What are the features of codeigniter?
 Codeigniter is free to use,its an open source framework.
 Its light weight.The core system requires only a few very small libraries.Not like other frameworks that require heavy file libraries.
Why codeigniter?
 CodeIgniter is Fast.Its faster than any other framework in php.
 The URLs generated by CodeIgniter are clean and search-engine friendly.You will change any url to what ever you want from files.
 CodeIgniter is Extensible.The system can be easily extended through the use of your own libraries, helpers, or through class extensions or system hooks.

What is MVC
 CodeIgniter Uses MVC(Model View Controller) which allows great separation between logic and presentation.

 CodeIgniter requires nearly zero configuration,does not require you to use the command line,not forced to learn a templating language.

 Full Featured database classes with support for several platforms,Security and XSS Filtering,Error Logging.
 Explain Codeigniter File Structure.

When you download Codeigniter you will see the following folder structure :-

    application
        cache
        Config
        Controllers
        core
        errors
        helpers
        hooks
        language
        libraries
        logs
        models
        thirdparty
        views
    system
        core
        database
        fonts
        helpers
        language
        libraries
 Explain MVC in Codeigniter.
  Controller:- The Controller serves as an intermediary between the Model
, the View. controller mediates input, converting it to
commands for the model or view.

Model:-The Model represents your data structures. Typically your model classes will contain functions that help you retrieve, insert,
and update information in your database.The model consists of application data and business rules.

View:-The View is the information that is being presented to a user. A View will normally be a web page.A view can be any output representation of data.

What are the hooks in codeigniter?
CodeIgniter’s Hooks feature provides a means to tap into and modify the inner workings of the framework without hacking the core files.How ever you like to cause some action to take place at a particular stage in the execution process.
he hooks feature can be globally enabled/disabled by setting the following item in the application/config/config.php file:
$config['enable_hooks'] = TRUE;

Hooks are defined in application/config/hooks.php file.For example
    $hook['pre_controller'] = array(
     'class'    => 'MyClass',
     'function' => 'Myfunction',
     'filename' => 'Myclass.php',
     'filepath' => 'hooks',
     'params'   => array('test', 'test1', 'webs')
     );

What are the helpers in codeigniter?
Helpers, as the name suggests, help you with tasks. Each helper file is simply a collection of functions in a particular category.There are URL Helpers, that assist in creating links, there are Form Helpers that help you create form elements, Text Helpers perform various text formatting routines, Cookie Helpers set and read cookies, File Helpers help you deal with files, etc.

Loading a helper file is quite simple using the following function:
    $this->load->helper('name');

How you will use or add codeigniter libraries?
All of the available libraries are located in your system/libraries folder. In most cases, to use one of these classes involves initializing it within a controller using the following initialization function:-
    $this->load->library('class name');