Skip to content
Interview Shortout
  • Home
  • Articles
  • PHP
  • Python
  • Java Script
  • MySQL
  • Magento
  • Startups
  • Other

Top 10 Codeigniter Interview Questions for Experienced

Posted on May 30, 2018August 27, 2022 By Dhananjay No Comments on Top 10 Codeigniter Interview Questions for Experienced
Codeigniter Interview Questions, Interview, PHP, PHP Interview Questions

What is hook?

CodeIgniter’s Hooks feature modify the core functionalities of the framework without changing the core files. For example, If you want to run a script right before your controllers get loaded, or right after or at any other location, you can use Hook.

How many types of hooks are there in Code Igniter?

There are 7 available hook points:

pre_system

Called very early during system execution. Only the benchmark and hooks class have been loaded at this point. No routing or other processes have happened.

pre_controller

Called prior to controllers being called. All base classes, routing, and security checks have been done

post_controller_constructor

Called after controller is instantiated, but prior to any method calls happening.

post_controller

Called after the controller is executed.

display_override

Overrides the _display() method, used to send the finalised page to the web browser at the end of system execution. This permits you to use your own display methodology.

Note that you will need to reference the CI super object with $this->CI->get_instance() and then the finalised data will be available by calling $this->CI->output->get_output().

cache_override:

Enables you to call your own method instead of the _display_cache() method in the Output Library. This permits you to use your own cache display mechanism.

post_system:

Called after the final rendered page is sent to the browser, at the end of system execution after the finalised data is sent to the browser.

How to Create a Hook in CodeIgniter?

<?php 
$my_hook = array(
    'class' => 'YourClassname',
    'function' => 'your_function_name',
    'filename' => 'your_filename.php',
    'params' => array('p1', 'p2'),
    'filepath' => 'hooks'
);
$hook['pre_controller'] = $my_hook;
?>

Can we use multiple call to same hook?

Yes , we can use multiple call to same hook. Then We have to use multidimensional array:
$hook[‘pre_controller’][]= $hook_one;
$hook[‘pre_controller’][]= $hook_two;

What are the benefits of using hook in an application?

-We can modify core functionalities without touching the core files.
-We can generate desired output without changing the view files.
-we can make a hook for recurring calls , like including footer and header in each function, without calling them in each controller function.
-we can create a script to minify the code before execution take place.
-We can easily implement security checks, privacy, session, cache using hooks and can separate these implementation from the main functionalities.

What is HMVC?

HMVC is a Modular version of MVC. In this system we can implement modules for particular purpose. We may have put out controller , views and model in different modules. All these modules will be available in modules folder in application. HMVC stands for Hierarchical Model View Controller.
 

What is a module?

A module is a part of application and a full featured block which is implemented on HMVC pattern. A module contains its own Model, View and Controller. Although these resources can be shared with other modules.
 

What is difference between Library and Helper?

A CodeIgniter helper is a set of related global functions, you can call them any where in application. Once you load the helper file you can directly call the function. Basically the helper is procedural.
But a Library is a class, which you need to make an instance of the class. Once the library is loaded, we need to use $this operator to call the Library function. This is Object Oriented.

 

What is Routes in Code Igniter Framework?

Routing is the communication between URI and Controller. Routing decides the controller calls and parameters in code igniter. We can overwrite the routing rules in routes.php file.

How to use or enable libraries CodeIgniter?

We can initialise the library in controllers as given below:
$this->load->library('my_library_class');

Why CodeIgniter is a loosely coupled MCV framework?

CodeIgniter is called a loosely coupled mvc because, it provides unlimited flexibility to developers. It allows us to write and execute our custom codes, library, helpers. We can use call model and controllers functions in views and also can write custom code on views. It works like a core php when some one is going to manipulate it and on the other side it provide a modular structure to our application, XSS and CSRF functionalities. It provides us lots of inbuilt library and also compatible with many more custom libraries. It never restricts us to write and execute any code.
Tags: MVC PHP

Post navigation

❮ Previous Post: CSS Interview Questions and Answers
Next Post: AJAX Interview Questions Answers ❯

Leave a Reply Cancel reply

You must be logged in to post a comment.

Doglapan

Recent Posts

  • Captable for Startups?
  • What is chat GPT?
  • All about Indexing in MySQL
  • Exploring the Growth and Future of Fintech Companies in Indian Startup Culture
  • Angel Investors in the Indian Startup Ecosystem: Understanding their Characteristics, Benefits and Role

Popular

AJAX artificial intelligence CakePHP Career Certifications CodeIgniter COVID Database Data Science DBMS DevOps Django Drupal ES6 Google Analytics HR Internship Interview Java Script jQuery Magento MVC MySQL PHP reactjs Risk Management Startups Training Visual Basic

Categories

  • AJAX
  • AJAX Interview Questions
  • Android
  • Articles
  • Artificial Intelligence
  • Banking
  • Big Data
  • Cake PHP Interview Questions
  • CakePHP
  • Career Guide
  • Certifications
  • CI/CD
  • Codeigniter Interview Questions
  • Codeigniter4
  • CSS
  • Data Science
  • DBMS
  • DevOps
  • Drupal
  • ES6 Interview Questions
  • Fresher Interview
  • Google Analytics
  • Gov Job
  • HR Interview
  • HTML
  • Internship
  • Interview
  • Java Script
  • jQuery
  • jQuery Interview Questions
  • JSON
  • Magento
  • MVC
  • MySQL
  • MySQL Interview Questions
  • OOPS
  • PHP
  • PHP Interview Questions
  • Python
  • Python Interview Questions
  • Reactjs Interview Questions
  • Resume
  • SEO
  • Startups
  • Visual Basic
  • WordPress
  • Wordpress Tutorial

Resources

  • Home
  • Paid Guest Post
  • About
  • Contact
  • Privacy Policy
  • DCMA
  • Home
  • Paid Guest Post
  • About
  • Contact
  • Privacy Policy
  • DCMA

Copyright © 2023 Interview Shortout.

Theme: Oceanly by ScriptsTown

Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage vendors Read more about these purposes
View preferences
{title} {title} {title}