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');
Related Posts:
  • Codeigniter count_all for pagination work on count_all condition.. you can use below method to find out total number of rows.. public function count_all() { $this->db->select ( 'COUNT(*) AS `numrows`' ); $this->db->where ( array ( … Read More
  • Codeigniter Database Library The  Database librarycontains a series of helpful functions that make it easy for you to create and run queries and process the result sets from those queries. The first thing to note about the Database library in Co… Read More
  • Checking the values of the form-codeigniter Checking the values of the form-codeigniter We need to ensure that all of the form fields have been filled in. We can do this by simply using the empty()PHP function. Before we do this, we want to assign the value of th… Read More
  • CodeIgniter models All CodeIgniter models have the same initial structure: < ?phpclass Page_model extends Model{function Page_model(){parent::Model();}}? > The first function is the code that retrieves the home page < ?phpclass P… Read More
  • Mysql Join query Codeigniter Mysql Join query Codeigniter code loads and initializes the database class based on your configuration settings. $query = $this->db->query('SELECT name, title, email FROM my_table'); foreach ($query->result() … Read More
  • Retrieving data-Codeigniter Retrieving POST data Toretrieve post data, you should use the function shown next. The first parameter is the name of the POST item that you are looking for.$this->input->post('some_field'); This function returns… Read More
  • e-mail parameters-Codeigniter The next thing that we will need to do is to set our e-mail parameters, the sender, the recipient, any e-mail address to send a carbon copy or blind carbon copy to, the subject of our e-mail, and the message body. Take a l… Read More
  • Let's Make A Master Template codeigniter A simple CSS file, it ’ s time to create a generic Template view that you can reuse throughout your application. In this master template, which you can name template.php, are a series of embedded PHP calls that load certain … Read More
  • codeigniter routes page The  routes.php filelets you remap URI requests to specific controller functions. For example, you may have a controller named sitewith a function named index. The URI for this controller/function combination might be… Read More
  • CodeIgniter config.php The  config.php filecontains a series of configuration options all of them stored in a PHP array called, appropriately enough, $config) that CodeIgniter uses to keep track of your application ’ s  information and… Read More
  • CodeIgniter system Folder The system/ folder is where all the action happens. This folder contains all the CodeIgniter code of consequence, organized into various folders: application —  The   application foldercontains the applicat… Read More
  • what is CodeIgniter Helpers? Helpers, as their name implies, help you with specific tasks. Unlike libraries, helpers are not object -oriented but procedural in nature. Each helper contains one or more functions, each focusing on a specific task, with ze… Read More
  • codeigniter-Creating loops Creating loops in view files has been a stumbling block for a few developers. By passing a multidimensional array to a view file, you can easily establish a loop in any of your view files. Let's take a look at an example.<… Read More
  • 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 ph… Read More