Getting Started on CodeIgniter, the lightening fast PHP Framework

Today, I have started on CodeIgniter, one of the powerful PHP frameworks recommended by Rasmus Lerdorf

CodeIgniter is most often noted for its speed when compared to other PHP frameworks. In a critical take on PHP frameworks in general, PHP creator Rasmus Lerdorf spoke at frOSCon in August 2008, noting that he liked CodeIgniter “because it is faster, lighter and the least like a framework”.

Read more about it here.

So far what I can tell you is that it really is FAST. I have been coding in CakePHP and Zend Framework, but this framework is very fast. Truely speaking I did not felt any difference using it.

I will keep posting about my experience of CodeIgniter.

Ubuntu 8.10, Perfect Linux distro for PHP development

I recently felt the urge to have a development testing environment on Linux (LAMP). I tried CentOS first since it is one of the leading industry standard Linux server. I was disappointed to see that CentOS does not have a 5.2.x series of PHP that I could install via “yum” (am not a very advance user so does not wanted to build it by typing long queries in SSH just to find out that I left some core thing in the first place).

I did a bit of research and found out that Ubuntu could be a better choice. Luckily I had the latest version of Ubuntu already shipped via Postal Mail (aka Snail Mail) and this time the CDs DID get through the customs.

For those new to Ubuntu, you can either download it or request FREE cds from Shipit.Ubuntu.com.

Ubuntu 8.10, the latest release, is a breeze to install and start running. I used VMWare Workstation to run it on my Windows installation.

Preparing Diskspace
Ubuntu 8.10 Preparing Diskspace (nice graphics)

Scanning Files
Ubuntu 8.10 Scanning Files

Installing System
Ubuntu 8.10 Installing System

Shutting Down
Ubuntu 8.10 Shutting Down after complete install

Using CakePHP’s Bake on Linux

If you want to use CakePHP’s bake tool on Linux command line (like I have development environment on Linux) then you can ssh to your linux box as shown in the screen shot below

Linux Console

Second, you can execute the cake bake command in the following manner

./cake/console/cake bake

as shown in the picture below
Linux Console

CakePHP – link / include JavaScript files in layouts

Create (or modify the) file

app/app_controller.php

add this code

class AppController extends Controller {
	var $helpers = array('Html', 'Form', 'Javascript');
}

CakePHP 1.2 allows you to define a reference to a Javascript file which is then added to the head section of the generated code. For this purpose the variable $scripts_for_layout has to be added to the layout:

<head>
	< ?php echo $scripts_for_layout; ?>
</head>

In the view you can now link to the Javascript file with:

$javascript->link('script.js', false);
// OR you can simply use $javascript->link('script.js');