Wednesday, January 2, 2013

Codeigniter get current controller/method name

//get current controller
$this->router->class;
 
//get current method
$this->router->method;

Wednesday, June 27, 2012

Minify Output Codeigniter 3.0

With latest dev version of 3.0, they have option for minify output. In /application/config/config.php just change it to TRUE

Show 404 error page instead "The URI you submitted has disallowed characters" error

it's really annoyed with this error page. I think show 404 error page is more clean

 Create a file named MY_URI.php in application/core/ and paste below code

Saturday, December 4, 2010

Codeigniter 2.0 Controller

class Welcome extends CI_Controller
{
function __construct()
{
parent::__construct();
}
}

Friday, August 6, 2010

Bit.ly Codeigniter

as simple as
$this->load->library('bitly');

then echo.simple!
echo $this->bitly->shorten('http://aizuddinmanap.blogspot.com/'); 

http://github.com/patrickpopowicz/bit.ly-Library-for-CodeIgniter/

Sunday, July 25, 2010

Form Validation Callbacks in HMVC in Codeigniter problem

create a file name MY_Form_validation.php and put it in the application/libraries folder
< ?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class MY_Form_validation extends CI_Form_validation
{
 function run($module = '', $group = '') {
 (is_object($module)) AND $this->CI =& $module;
 return parent::run($group);
 }
}
/* End of file MY_Form_validation.php */
/* Location: ./application/libraries/MY_Form_validation.php */  

when using validation, put $this into the $this->form_validation->run()
example
if($this->form_validation->run($this)) {
//your code down there 
}

Thursday, July 1, 2010