Category Archives: CodeIgniter

CodeIgniter with Zebra Session



Do not use session_start();

Note: Put $session in $GLOBALS is very important or this variable wont’ be accessible in controllers and data in session will be lost after redirection and won’t be saved in database.


  1. If session doesn’t work after redirection, try clear all data in table “session_data”

Join in CodeIgniter


AjaxResponse Trait for CodeIgniter 2




Static function in CodeIgniter

In Model (Products_m.php):

In Controller:


Generate Facebook Product Catalog Feed (XML)

Facebook Doc:

CodeIgniter XML Helper:

Sample Code:



Old utf8 char_set could cause unexpected error like

Here is example string:

To solve this, change char set settings in config file of CodeIgniter:


Upload Error Handler

There are 2 configs in php.ini related to upload process:

  • post_max_size
  • upload_max_filesize

If the size of your post is over post_max_size, system could cause an error without any warning and $_POST could be empty for no reason. So it’s important to check post size before you start to process a form submit.

Helper functions:

Other programming issue:


base_url config (https or http)