Where do I put image files, css, js, etc. in Codeigniter?

I have a setup like this: application system assets js imgs css I then have a helper function that simply returns the full path to this depending on my setup, something similar to: application/helpers/utility_helper.php: function asset_url(){ return base_url().’assets/’; } I will usually keep common routines similar to this in the same file and autoload it … Read more

Using Mysql WHERE IN clause in codeigniter

You can use sub query way of codeigniter to do this for this purpose you will have to hack codeigniter. like this Go to system/database/DB_active_rec.php Remove public or protected keyword from these functions public function _compile_select($select_override = FALSE) public function _reset_select() Now subquery writing in available And now here is your query with active record … Read more

Routing controllers in subfolders using CodeIgniter

Do this: $route[‘store/(:any)’] = ‘frontend/store/$1’; $route[‘processing/(:any)’] = ‘frontend/processing/$1’; $route[‘profile/(:any)’] = ‘frontend/profile/$1’; Same for backend : $route[‘backend/(:any)’] = ‘backend/authenticate/$1′; You don’t have to create each rule in routes.php for every function of the controller, rather one rule per controller will be enough as mentioned above. URI Routing : CodeIgniter User Guide $1 represent the first expression, … Read more

CodeIgniter PHP Model Access “Unable to locate the model you have specified”

When creating models, you need to place the file in application/models/ and name the file in all lowercase – like logon_model.php The logon_model.php should contain the following: <?php if ( ! defined(‘BASEPATH’)) exit(‘No direct script access allowed’); class Logon_model extends CI_Model { public function __construct() { parent::__construct(); } … Now, what you can do, to … Read more

Codeigniter REST CSV import to mysql

Here is an easy way to do this. I don’t know what people do but i use this This is my csv reader library, Save this in libraries folder as csvreader.php. <?php if (!defined(‘BASEPATH’)) exit(‘No direct script access allowed’); class CSVReader { var $fields; /** columns names retrieved after parsing */ var $separator=”;”; /** separator … Read more

Only variable references should be returned by reference – Codeigniter

Edit filename: core/Common.php, line number: 257 Before return $_config[0] =& $config; After $_config[0] =& $config; return $_config[0]; Update Added by NikiC In PHP assignment expressions always return the assigned value. So $_config[0] =& $config returns $config – but not the variable itself, but a copy of its value. And returning a reference to a temporary … Read more