Friday, January 15, 2010

installing lxml on Mac.

STATIC_DEPS=true sudo easy_install lxml

works while
sudo STATIC_DEPS=true easy_install lxml doesnt work

Tuesday, January 12, 2010

CodeIgniter - removing Index.php from path and enable $_GET

Enable Mod_rewrite in apache

in htaccess file

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

check in your apache config:

AllowOverride All
It works
http://example.com/foo/fun should work
also
http://example.com/index.php/foo/fun works

Get request issue solution got from Al James. republishing it here. thanks Al James.

I have recently added $_GET support to my CI project.

I wanted to do this in such a way as to avoid hacking the CI code. Its actually quite simple.

Firstly, set the config item for uri_protocol to use PATH_INFO:

$config['uri_protocol'] = "PATH_INFO";
This ensures that query string parts dont get treated like the rest of the CI uri structure (resulting in lots of 404 not founds).


Secondly, you need to extend the default Input library in order to stop it clearing the $_GET variable. Place the following file (called MY_Input.php) in your application/libraries/ folder:

class MY_Input extends CI_Input {

function _sanitize_globals()
{
$this->allow_get_array = TRUE;
parent::_sanitize_globals();
}

}
This basically overrides the Input.php class to allow $_GET variables, but does not open up CI to query string URI routing (as it would if we simply set $config[‘enable_query_strings’] = TRUE).

Of course you will need to make sure that your config file specifies you subclass_prefix to be ‘MY_’, i.e.:

$config['subclass_prefix'] = 'MY_';
If its not, you can change the filename and classname of the above code accordingly!

That works for me anyway

Tuesday, January 05, 2010