What is code igniter?
Code Igniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications.
What are the features of code igniter?
·         Codeigniter is free to use, it’s an open source framework.
·         Model-View-Controller Based System.
·         Extremely Light Weight.
·         Full Featured database classes with support for several platforms.
·         CodeIgniter is Extensible. The system can be easily extended through the use of your own libraries, helpers, or through class extensions or system hooks.
·         Excelent documentation.
·         Full Featured database classes with support for several platforms, Security and XSS Filtering, Error Logging.
Explain Codeigniter File Structure?
following are the folder structure:
·         application
o   cache
o   Config
o   Controllers
o   core
o   errors
o   helpers
o   hooks
o   language
o   libraries
o   logs
o   models
o   thirdparty
o   views
·         System
o   core
o   database
o   fonts
o   helpers
o   language
o   libraries
Explain Application Flow Chart in codeigniter?
The following graphic illustrates how data flows throughout the system:
·         The index.php serves as the front controller, initializing the base resources needed to run CodeIgniter.
·         The Router examines the HTTP request to determine what should be done with it.
·         If a cache file exists, it is sent directly to the browser, bypassing the normal system execution.
·         Security. Before the application controller is loaded, the HTTP request and any user submitted data is filtered for security.
·         The Controller loads the model, core libraries, helpers, and any other resources needed to process the specific request.
·         The finalized View is rendered then sent to the web browser to be seen. If caching is enabled, the view is cached first so that on subsequent requests it can be served.
Explain MVC in Codeigniter?
CodeIgniter is based on the Model-View-Controller development pattern. MVC is a software approach that separates application logic from presentation. In practice, it permits your web pages to contain minimal scripting since the presentation is separate from the PHP scripting.
·         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 View is the information that is being presented to a user.
·         A View will normally be a web page, but in CodeIgniter, a view can also be a page fragment like a header or footer. It can also be an RSS page, or any other type of "page".
·         The Controller serves as an intermediary between the Model, the View, and any other resources needed to process the HTTP request and generate a web page.
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. When CodeIgniter runs it follows a specific execution process, diagramed in the Application Flow page. There may be instances, however, where you'd like to cause some action to take place at a particular stage in the execution process. For example, you might want to run a script right before your controllers get loaded, or right after, or you might want to trigger one of your own scripts in some other location.
The hooks feature can be globally enabled/disabled by setting the following item in the application/config/config.php file:
$config['enablehooks'] = TRUE;
How you will load a model in codeigniter?
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.
Unlike most other systems in CodeIgniter, Helpers are not written in an Object Oriented format. They are simple, procedural functions. Each helper function performs one specific task, with no dependence on other functions.
Loading a helper file is quite simple using the following function:
How you will use or add codeigniter libraries?
When we use the term "Libraries" we are normally referring to the classes that are located in the libraries directory and described in the Class Reference of this user guide. In this case, however, we will instead describe how you can create your own libraries within your application/libraries directory in order to maintain separation between your local resources and the global framework resources.
See more at http://ellislab.com/codeigniter/user-guide/general/creatinglibraries.html
How you will work with error handling in codeigniter?
CodeIgniter lets you build error reporting into your applications using the functions described below. In addition, it has an error logging class that permits error and debugging messages to be saved as text files.
show_error('message' [, int $statuscode= 500 ] )
This function will display the error message supplied to it using template application/errors/errorgeneral.php.
show_404('page' [, 'logerror'])
This function will display the 404 error message supplied to it using template application/errors/error404.php.
log_message('level', 'message')
This function lets you write messages to your log files. You must supply one of three "levels" in the first parameter, indicating what type of message it is (debug, error, info), with the message itself in the second parameter.
How to access config variable in codeigniter?
You can access config variable like:
$this->config->item('variable name');
How to unset session in codeigniter?
We can use unsetuserdata to destroy particular session variable
We can use sessdestroy to destroy all session:
How do you use aliases with autoloading models in codeigniter?
We can auto load model like this:
$autoload['model'] = array(array('usersmodel', 'users'), array('newsmodel', 'news'), 'categorymodel');
How to get random records in mysql using codeigniter?
We can use this:
How to print SQL statement in codeigniter model?
We can use this:
What are the security parameter for XSS in CodeIgniter?
Codeigniter has got a cross-site scripting hack prevention filter. This filter either runs automatically or you can run it as per item basis, to filter all POST and COOKIE data that come across. The XSS filter will target the commonly used methods to trigger JavaScript or other types of code that attempt to hijack cookies or other malicious activity. If it detects any suspicious thing or anything disallowed is encountered, it will convert the data to character entities.
What is the default URL pattern used in Codeigniter framework?
Codeigniter framework URL has four main components in default URL pattern. First we have the server name and next we have the controller class name followed by controller function name and function parameters at the end. Codeigniter can be accessed using the URL helper. For examplehttp://servername/controllerName/controllerFunction/parameter1/parameter2.
How do you get last insert id in code igniter?
We can get with this.
How do you set default timezone in codeigniter?

We can do by adding date_default_timezone_set('America/LosAngeles'); in index.php
Request to Download PDF

Post A Comment: