Taking care of the www issue in CodeIgniter

One of the problems that came up with the rising dependency on Google and SEO in general is the use of www. On the one hand there is no reason to use www anymore. 100% of modern browsers use the HTTP protocol by default so you don’t need to specify that you need to access the web part of a domain. It makes your site’s address larger and harder to remember, more ugly, less likely to fit alongside a logo. Also many suspect that it has an effect on your keyword density, therefore harming your search engine rank just a little bit. On the other hand most of the users still keep the old habit of typing www.site.com in the address bar.
Read the rest of the post »

Templates in CodeIgniter

One of the most annoying stuff for CodeIgniter developers is to include a header/footer/etc part in each and every view. CodeIgniter out of the box does not include template support (in the sence of a Joomla template or Wordpress theme). I have created a small library to assist you in using “templates” in CodeIgniter.

Download

Download Templates for CodeIgniter 0.1

How to use

1) First copy the file MY_loader.php to your application/libraries folder.
2) Check the example folder to see how a template should look like.
3) Simply do:

$this->load->template('template_name', $data);
$this->load->view('view_name', $data);

The template loading is done in pretty much the same way as the views loading. However please read the comments inside the MY_loader.php file. It takes one minute and you’ll get the whole picture about how you can pass $data arrays containing variables.