# Hello, World Just about every framework ever written has some kind of hello world example included, so it'd be pretty rude of us to break this tradition! We'll start out by creating a very very basic hello world, and then we'll expand it to follow MVC principles. ## Bare bones First off we have to make a controller that Kohana can use to handle a request. Create the file `application/classes/Controller/Hello.php` in your application folder and fill it out like so: template->message = 'hello, world!'; } } `extends Controller_Template` : We're now extending the template controller, it makes it more convenient to use views within our controller. `public $template = 'site';` : The template controller needs to know what template you want to use. It'll automatically load the view defined in this variable and assign the view object to it. `$this->template->message = 'hello, world!';` : `$this->template` is a reference to the view object for our site template. What we're doing here is assigning a variable called "message", with a value of "hello, world!" to the view. Now lets try running our code... ![Hello, World!](hello_world_2_error.png "Hello, World!") For some reason Kohana's thrown a wobbly and isn't showing our amazing message. If we look at the error message we can see that the View library wasn't able to find our site template, probably because we haven't made it yet – *doh*! Let's go and make the view file `application/views/site.php` for our message: We've got a message for you!

We just wanted to say it! :)

If we refresh the page then we can see the fruits of our labour: ![hello, world! We just wanted to say it!](hello_world_2.png "hello, world! We just wanted to say it!") ## Stage 3 – Profit! In this tutorial you've learnt how to create a controller and use a view to separate your logic from your display. This is obviously a very basic introduction to working with Kohana and doesn't even scrape the potential you have when developing applications with it.