Say Hello to Kohana 3

kohana 3 php logo 550x241 Say Hello to Kohana 3 photo
Kohana 3 has been released for a while. This is a redesign version of Kohana. Kohana 3 and 2 will both be in active, if you are new to Kohana, I suggest you to start with Kohana 3. The most important difference between these two version is that Kohana 3 uses a new design pattern HMVC rather than MVC as Kohana 2 is using. What is HMVC? These two articles may help you understand it:

  1. Presentation-abstraction-control
  2. HMVC Pattern For GUI Of Swing/GWT/Desktop Application

You can download Kohana 3 here:

Kohana 3 Download

As usual, it’s extremely easy to install Kohana, unzip the download file, put the Kohana folder to your web server, change permissions of following folders to 777:

  1. application/cache
  2. application/logs

Finally make some changes to application/bootstrap.php:

  1. Change timezone
  2. Set the base_url

That’s it, your Kohana is ready to go. Visit your website which should be the base_url you set above, you will see the Environment Tests page:

kohana install 1 550x369 Say Hello to Kohana 3 photo

Notice the green background text, it’s telling you to delete the install.php file in you Kohana root. And then refresh the page, you will see “hello, world!” text. Where is the text come from? Open application->classes->controller, there is a welcome.php there. Double click the file, Here is the code:

<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Welcome extends Controller {

	public function action_index()
	{
		$this->request->response = 'hello, world!';
	}

} // End Welcome

This is the Welcome controller, the only thing it do is to print the text ‘hello, world!’ to the screen. You can try to output other text by change:

$this->request->response = 'hello, world!';

to:

$this->request->response = 'hello, Kohana 3! I am Zack from ZackLive.com~';

Now you’ve got your Kohana installed, try to get your hands dirty.

Some useful resource for Kohana 3:

  1. Kohana 3 User Guide
  2. Kohana 3 Unofficial Wiki
  3. Kohana 3 API Cheat Sheet

If you’ve got any questions about Kohana 3, feel free to ask me by commenting here or post on Kohana forum.


Feel free to visit our Forum, subscribe our RRS Feed for news updates, and follow us on Twitter.

Related Posts

This entry was posted in Web Design and tagged , , , , , , , . Bookmark the permalink.

One Response to Say Hello to Kohana 3

  1. Pingback: Zack Live

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>