Remove the index.php from your codeigniter URL
Posted on Sunday 19 July 2009

When you create a standard new codeigniter application, there’s always a index.php in your url. It’s kind of ugly in your url so I prefer to remove this. To remove this you need to do a couple of things:
change the $config[‘index_page’] to $config[‘index_page’]=”“ instead of $config[‘index_page’]=“index.php”
Next create a .htaccess file in the root of your CI application with the following:
RewriteEngine on
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond % !-f
RewriteCond % !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Automatic config Base_url in CodeIgniter
Posted on Friday 17 July 2009

If you don‘t like to change the base_url in your Codeigniter config file every time you move your application. Just replace it with the following:
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
It also works with https.
How to resize youtube or vimeo movies with PHP
Posted on Wednesday 27 May 2009

You have to use the preg_replace php function here. The $video variable holds the embed code fromyoutube, vimeo or other similar website that use these parameters in their embed codes in the example. You can change the width and height in the second parameter. This will replace the width and height parameters in you embed code with you desired width. That way inserted video‘s by users won‘t mess up your layout.
$video = preg_replace('/(width)=("[^"]*")/i', 'width="270"', $video);
$video = preg_replace('/(height)=("[^"]*")/i', 'height="270"', $video);
Add www to your domain or remove the www from your domain
Posted on Tuesday 26 May 2009

This is important not only for aesthetic reasons, but for SEO (Search Engine Optimization). Forcing www before your domain or removing it prevents search engines from ending up with duplicate results and different page ranks per page. Some websites don‘t even return a page when you leave out the www. This depends on how your webserver is set up.
Multi-language support with Smarty
Posted on Wednesday 13 May 2009
Languages have always been a stumbling block for developers. With smarty you can make language files containing all the words that need to be translated and smarty will replace the language variables with the correct language. Smarty is also able to automatically check the browser language. I found this language class on the http://smarty.incutio.com/ website.
How to force plaintext insertion on paste in tiny_mce
Posted on Sunday 10 May 2009
Several clients of ours seem to type the text for their websites in a Word document fires and copy them afterwards in tiny_mce. Apparently tiny_mce copies the layout from word or any other program so the layout in your website gets messed up. I found a solution for this. You have to enforce pasting as plaintext which removes all markup when you paste something within tiny_mce.
copy these lines within your init function:
//force text to be pasted as plaintext
setup: function(ed) {
ed.onPaste.add( function(ed, e, o) {
ed.execCommand('mcePasteText', true);
return tinymce.dom.Event.cancel(e);
});
},