Codeiginter Interview Questions
Codeiginter Interview Questions

Codeiginter Interview Questions

1.) Load Helper In CI: $this->load->helper(array());
2.) Load Model In CI: $this->load->model(‘model_name’);
3.) Load Library In CI: $this->load->library(‘library_name’);
4.) Load View In CI: $this->load->view(‘view_name’);
5.) Load Database In CI: $this->load->database(‘database_name’);
6.) In autoloader.php we define Packages, Libraries, Drivers, Helper files, Custom config files,
Language files and Models so that they called automatically when CI project loaded.
7.) In router file we define routing of all controller methods. We define few things such as
default_controller, 404_override, translate_uri_dashes
8.) Load Driver In CI: $this->load->driver(‘driver_name’);
9.) An inhibitor in CodeIgniter is an error handler class. It will make use of PHP’s native functions like
set_error_handler, set_exception_handler, register_shutdown_function to handle parse
errors, exceptions, and fatal errors.
10.) Session In CI: For access the session in CI. You have to load session library. For Example:
$this->load->library(‘session’); $this->session->set_userdata(‘key’,’value’); $this->session-
>unset_userdata(‘key’);
11.) CodeIgniter’s hooks will provide a way to change the internal workings or framework
functionalities without any need for hacking the core files. It permits script execution with a
particular path within the CodeIgniter. We can globally enable/disable the hooks feature by setting
the below-given item in the application/config/config.php file: $config[‘enable_hooks’] = TRUE; It
is defined in application/config/hooks.php file. For example: $hook[‘pre_controller’] =

array( ‘class’ => ‘MyHookClass’,
‘function’ => ‘Myhookfunction’,‘filename’ => ‘MyHookClass.php’,‘filepath’ => ‘hooks’,
‘params’ => array(‘test’, ‘test1’, ‘webs’) );

12.) CI version: ( I ) echo CI_VERSION; (II) system/core/CodeIgniter.php
13.) Error handling: CodeIgniter enables you to develop error reporting into your applications by
using the below-given functions. Also, it has a class dedicated to error logging that permits
messages related to error and debugging to be saved as text files. I)
show_error(‘message’ [, int $statuscode= 500 ] ) : This function will display the error message
provided by the application/errors/errorgeneral.php template. II)
show_404(‘page’ [, ‘logerror’]): This function shows the 404 error message supplied to it by
using the application/errors/error404.php template.
14.) Codeigniter has got a Cross-Site Scripting(XSS) hack prevention filter. This filter either
automatically runs or you can run it based on item, to filter all data related to POST and COOKIE.
To filter data through the XSS filter, we will make use of the xss_clean() method as given below:
$data = $this->security->xss_clean($data);
15.) Last Insert Id In CI: $this->db->insert_id()

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *