Category: CodeIgniter

  • Page Caching

    Caching a page will improve the page load speed. If the page is cached, then it will be stored in its fully rendered state. Next time, when the server gets a request for the cached page, it will be directly sent to the requested browser. Cached files are stored in application/cache folder. Caching can be enabled on…

  • Common Functions

    CodeIgniter library functions and helper functions need to be initialized before they are used but there are some common functions, which do not need to be initialized. These common functions and their descriptions are given below. Syntax is_php($version) Parameters $version (string) − Version number Return TRUE if the running PHP version is at least the one…

  • Cookie Management

    Cookie is a small piece of data sent from web server to store on client’s computer. CodeIgniter has one helper called “Cookie Helper” for cookie management. Syntax set_cookie($name[, $value = ”[, $expire = ”[, $domain = ”[, $path = ‘/’[, $prefix = ”[, $secure = FALSE[, $httponly = FALSE]]]]]]]]) Parameters $name (mixed) − Cookie name or associative array of all of the…

  • Tempdata

    In some situations, where you want to remove data stored in session after some specific time-period, this can be done using tempdata functionality in CodeIgniter. Add Tempdata To add data as tempdata, we have to use mark_as_tempdata() function. This function takes two argument items or items to be stored as tempdata and the expiration time for those items are as shown below.…

  • Flashdata

    While building web application, we need to store some data for only one time and after that we want to remove that data. For example, to display some error message or information message. In PHP, we have to do it manually but CodeIgniter has made this job simple for us. In CodeIgniter, flashdata will only…

  • Session Management

    When building websites, we often need to track user’s activity and state and for this purpose, we have to use session. CodeIgniter has session class for this purpose. Initializing a Session Sessions data are available globally through the site but to use those data we first need to initialize the session. We can do that by…

  • Form Validation

    Validation is an important process while building web application. It ensures that the data that we are getting is proper and valid to store or process. CodeIgniter has made this task very easy. Let us understand this process with a simple example. Example Create a view file myform.php and save the below code it in application/views/myform.php. This page…

  • Sending Email

    Sending email in CodeIgniter is much easier. You also configure the preferences regarding email in CodeIgniter. CodeIgniter provides following features for sending emails − Email class has the following functions to simplify the job of sending emails. S.N. Syntax Parameters Return Return Type 1 from($from[, $name = ”[, $return_path = NULL]]) $from (string) − “From” e-mail address$name (string) −…

  • File Uploading

    Using File Uploading class, we can upload files and we can also, restrict the type and size of the file to be uploaded. Follow the steps shown in the given example to understand the file uploading process in CodeIgniter. Example Copy the following code and store it at application/view/Upload_form.php. Copy the code given below and store…

  • Error Handling

    Many times, while using application, we come across errors. It is very annoying for the users if the errors are not handled properly. CodeIgniter provides an easy error handling mechanism. You would like the messages to be displayed, when the application is in developing mode rather than in production mode as the error messages can…