Kohana v3.03 reset

Download Kohana v3.0.3

Upload files to your server

Fix these paths inside index.php:

$application = '../application';
$modules = '../modules';
$system = '../system';

Try accessing to make sure you installed correctly:


Some tweaks:

Inside application/bootstrap.php:

 'base_url' => '/',
 'index_file' => '',

Now create: application/classes/controller/layout.php

Now extend the previous controller: application/classes/controller/website.php

And create a controller to handle content: application/classes/controller/content.php

Creating a content controller using Kohana v3.0

These are the things I needed to change on .httacess to have kohana default files working before creating my first controller:

 # Turn on URL rewriting
RewriteEngine On

# Installation directory
RewriteBase /kohana/

# Protect hidden files from being viewed
<Files .*>
 Order Deny,Allow
 Deny From All

# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)b - [F,L]

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]

My Kohana v3 installation is not inside a folder, so I’m changing "/kohana/" to "/".

I want to use my Content controller to show content for the front page and any other content pages read from the database, so I am doing the following changes to my /application/bootstrap file:

Route::set('default', '(<controller>(/<action>(/<id>)))')
 'controller' => 'content',
 'action'     => 'index',

Create the Content controller file /application/classes/controller/content.php

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

class Controller_Content extends Controller {

 public function action_index()
 $this->request->response = 'This is the content controller!';

 public function action_view()
 $this->request->response = 'This is the content controller [view action]!';

} // End Welcome
  • IGlr