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

base_url in 404 error page codeigniter

simple to use
<?php echo config_item('base_url');?>
:)

Thursday, June 24, 2010

Saturday, June 19, 2010

Codeigniter Route Everything, except these Controllers

another Codeigniter routes, Codeigniter Route Everything, except these Controllers

There was a recent post on the codeigniter forums trying to get urls like these:
http://yoursite.com/your-slug
This problem could have been easily resolved using this route:
$route['(:any)'] = 'articles/$1';

In this route, all characters after the domain will be passed to the controller, 'article'.

However, the problem was he also had some controllers that he didn't want to use the route for. A quick fix for the route was to use a 'simple' regex using negative lookahead
$route['^(?!controller|controller|controller)\S*'] = "article/$1";


p/s:original post from here

codeigniter routes

how to use http://localhost/receipt/view/1 as http://localhost/receipt/1 ?
routes is the solution.

1)edit /application/config/routes.php

2)
$route['receipt/(:num)'] = "receipt/view/$1";

Wednesday, June 16, 2010