Skip to content

Commit

Permalink
Initialised nl as a translation with recent EN-files as fall back, no…
Browse files Browse the repository at this point in the history
…thing translated yet except the menu
  • Loading branch information
glamorous committed Jun 23, 2010
1 parent 656c7ff commit e3e9e89
Show file tree
Hide file tree
Showing 36 changed files with 2,352 additions and 234 deletions.
Expand Up @@ -2,9 +2,7 @@

Controllers stand in between the models and the views in an application. They pass information on to the model when data needs to be changed and they request information from the model. For example database inserts, updates and deletes for data change and database selects for information retrieval. Controllers pass on the information of the model to the views, the views contain the final output for the users.

Controllers are called by a URL, see [URLs and Links](start.urls) for more information.


Controllers are called by a URL, see [URLs and Links](about.urls) for more information.

## Controller naming and anatomy

Expand Down Expand Up @@ -75,7 +73,7 @@ Article list goes here!

Say we want to display a specific article, for example the article with the title being `your-article-title` and the id of the article is `1`.

The url would look like yoursite.com/article/view/**your-article-title/1** The last two segments of the url are passed on to the view() method.
The url would look like yoursite.com/article/view/**your-article-title/1**. The last two segments of the url are passed on to the view() method.

**application/classes/controller/article.php**
~~~
Expand Down
27 changes: 27 additions & 0 deletions guide/nl/about.conventions.md
@@ -0,0 +1,27 @@
# Conventions

It is encouraged to follow Kohana's [coding style](http://dev.kohanaframework.org/wiki/kohana2/CodingStyle). This uses [BSD/Allman style](http://en.wikipedia.org/wiki/Indent_style#BSD.2FAllman_style) bracing, among other things.

## Class Names and File Location {#classes}

Class names in Kohana follow a strict convention to facilitate [autoloading](using.autoloading). Class names should have uppercase first letters with underscores to separate words. Underscores are significant as they directly reflect the file location in the filesystem.

The following conventions apply:

1. CamelCased class names should not be used, except when it is undesirable to create a new directory level.
2. All class file names and directory names are lowercase.
3. All classes should be in the `classes` directory. This may be at any level in the [cascading filesystem](about.filesystem).

[!!] Unlike Kohana v2.x, there is no separation between "controllers", "models", "libraries" and "helpers". All classes are placed in the "classes/" directory, regardless if they are static "helpers" or object "libraries". You can use whatever kind of class design you want: static, singleton, adapter, etc.

## Examples

Remember that in a class, an underscore means a new directory. Consider the following examples:

Class Name | File Path
----------------------|-------------------------------
Controller_Template | classes/controller/template.php
Model_User | classes/model/user.php
Database | classes/database.php
Database_Query | classes/database/query.php
Form | classes/form.php
86 changes: 86 additions & 0 deletions guide/nl/about.filesystem.md
@@ -0,0 +1,86 @@
# Cascading Filesystem

The Kohana filesystem is a heirarchy of directory structure. When a file is
loaded by [Kohana::find_file], it is searched in the following order:

Application Path
: Defined as `APPPATH` in `index.php`. The default value is `application`.

Module Paths
: This is set as an associative array using [Kohana::modules] in `APPPATH/bootstrap.php`.
Each of the values of the array will be searched in the order that the modules
are added.

System Path
: Defined as `SYSPATH` in `index.php`. The default value is `system`. All of the
main or "core" files and classes are defined here.

Files that are in directories higher up the include path order take precedence
over files of the same name lower down the order, which makes it is possible to
overload any file by placing a file with the same name in a "higher" directory:

![Cascading Filesystem Infographic](img/cascading_filesystem.png)

If you have a view file called `welcome.php` in the `APPPATH/views` and
`SYSPATH/views` directories, the one in application will be returned when
`welcome.php` is loaded because it is at the top of the filesystem.

## Types of Files

The top level directories of the application, module, and system paths has the following
default directories:

classes/
: All classes that you want to [autoload](using.autoloading) should be stored here.
This includes controllers, models, and all other classes. All classes must
follow the [class naming conventions](about.conventions#classes).

config/
: Configuration files return an associative array of options that can be
loaded using [Kohana::config]. See [config usage](using.configuration) for
more information.

i18n/
: Translation files return an associative array of strings. Translation is
done using the `__()` method. To translate "Hello, world!" into Spanish,
you would call `__('Hello, world!')` with [I18n::$lang] set to "es-es".
See [translation usage](using.translation) for more information.

messages/
: Message files return an associative array of strings that can be loaded
using [Kohana::message]. Messages and i18n files differ in that messages
are not translated, but always written in the default language and referred
to by a single key. See [message usage](using.messages) for more information.

views/
: Views are plain PHP files which are used to generate HTML or other output. The view file is
loaded into a [View] object and assigned variables, which it then converts
into an HTML fragment. Multiple views can be used within each other.
See [view usage](usings.views) for more information.

## Finding Files

The path to any file within the filesystem can be found by calling [Kohana::find_file]:

// Find the full path to "classes/cookie.php"
$path = Kohana::find_file('classes', 'cookie');

// Find the full path to "views/user/login.php"
$path = Kohana::find_file('views', 'user/login');


# Vendor Extensions

We call extensions that are not specific to Kohana "vendor" extensions.
For example, if you wanted to use [DOMPDF](http://code.google.com/p/dompdf),
you would copy it to `application/vendor/dompdf` and include the DOMPDF
autoloading class:

require Kohana::find_file('vendor', 'dompdf/dompdf/dompdf_config.inc');

Now you can use DOMPDF without loading any more files:

$pdf = new DOMPDF;

[!!] If you want to convert views into PDFs using DOMPDF, try the
[PDFView](http://github.com/shadowhand/pdfview) module.
73 changes: 73 additions & 0 deletions guide/nl/about.flow.md
@@ -0,0 +1,73 @@
# Request Flow

Every application follows the same flow:

1. Application starts from `index.php`.
2. The application, module, and system paths are set.
3. Error reporting levels are set.
4. Install file is loaded, if it exists.
5. The [Kohana] class is loaded.
6. The bootstrap file, `APPPATH/bootstrap.php`, is included.
7. [Kohana::init] is called, which sets up error handling, caching, and logging.
8. [Kohana_Config] readers and [Kohana_Log] writers are attached.
9. [Kohana::modules] is called to enable additional modules.
* Module paths are added to the [cascading filesystem](about.filesystem).
* Includes the module `init.php` file, if it exists.
* The `init.php` file can perform additional environment setup, including adding routes.
10. [Route::set] is called multiple times to define the [application routes](using.routing).
11. [Request::instance] is called to start processing the request.
1. Checks each route that has been set until a match is found.
2. Creates the controller instance and passes the request to it.
3. Calls the [Controller::before] method.
4. Calls the controller action, which generates the request response.
5. Calls the [Controller::after] method.
* The above 5 steps can be repeated multiple times when using [HMVC sub-requests](about.mvc).
12. The main [Request] response is displayed

## index.php

Kohana follows a [front controller] pattern, which means that all requests are sent to `index.php`. This allows a very clean [filesystem](about.filesystem) design. In `index.php`, there are some very basic configuration options available. You can change the `$application`, `$modules`, and `$system` paths and set the error reporting level.

The `$application` variable lets you set the directory that contains your application files. By default, this is `application`. The `$modules` variable lets you set the directory that contains module files. The `$system` variable lets you set the directory that contains the default Kohana files.

You can move these three directories anywhere. For instance, if your directories are set up like this:

www/
index.php
application/
modules/
system/

You could move the directories out of the web root:

application/
modules/
system/
www/
index.php

Then you would change the settings in `index.php` to be:

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

Now none of the directories can be accessed by the web server. It is not necessary to make this change, but does make it possible to share the directories with multiple applications, among other things.

[!!] There is a security check at the top of every Kohana file to prevent it from being accessed without using the front controller. However, it is more secure to move the application, modules, and system directories to a location that cannot be accessed via the web.

### Error Reporting

By default, Kohana displays all errors, including strict mode warnings. This is set using [error_reporting](http://php.net/error_reporting):

error_reporting(E_ALL | E_STRICT);

When you application is live and in production, a more conservative setting is recommended, such as ignoring notices:

error_reporting(E_ALL & ~E_NOTICE);

If you get a white screen when an error is triggered, your host probably has disabled displaying errors. You can turn it on again by adding this line just after your `error_reporting` call:

ini_set('display_errors', TRUE);

Errors should **always** be displayed, even in production, because it allows you to use [exception and error handling](debugging.errors) to serve a nice error page rather than a blank white screen when an error happens.
9 changes: 5 additions & 4 deletions guide/nl/start.installation.md → guide/nl/about.install.md
@@ -1,19 +1,20 @@
# Installation

1. Download the latest **stable** release from the [Kohana website](http://kohanaphp.com/)
1. Download the latest **stable** release from the [Kohana website](http://kohanaframework.org/)
2. Unzip the downloaded package to create a `kohana` directory
3. Upload the contents of this folder to your webserver
4. Open `application/bootstrap.php` and make the following changes:
- Set the default [timezone](http://php.net/timezones) for your application
- Set the `base_url` in the [Kohana::init] call to reflect the location of the kohana folder on your server
6. Make sure the `application/cache` and `application/logs` directories are world writable with `chmod application/{cache,logs} 0777`
6. Make sure the `application/cache` and `application/logs` directories are writable by the web server
7. Test your installation by opening the URL you set as the `base_url` in your favorite browser

[!!] Depending on your platform, the installation's subdirs may have lost their permissions thanks to zip extraction. Chmod them all to 755 by running `find . -type d -exec chmod 0755 {} \;` from the root of your Kohana installation.

You should see the installation page. If it reports any errors, you will need to correct them before contining.
You should see the installation page. If it reports any errors, you will need to correct them before continuing.

![Install Page](img/install.png "Example of install page")

Once your install page reports that your environment is set up correctly you need to either rename or delete `install.php` in the root directory. You should then see the Kohana welcome page. (?? Currently just 'Hello World!' in KO3 ??)
Once your install page reports that your environment is set up correctly you need to either rename or delete `install.php` in the root directory. You should then see the Kohana welcome page:

![Welcome Page](img/welcome.png "Example of welcome page")
15 changes: 15 additions & 0 deletions guide/nl/about.kohana.md
@@ -0,0 +1,15 @@
# What is Kohana?

Kohana is an open source, [object oriented](http://wikipedia.org/wiki/Object-Oriented_Programming) [MVC](http://wikipedia.org/wiki/Model–View–Controller "Model View Controller") [web framework](http://wikipedia.org/wiki/Web_Framework) built using [PHP5](http://php.net/manual/intro-whatis "PHP Hypertext Preprocessor") by a team of volunteers that aims to be swift, secure, and small.

[!!] Kohana is licensed under a [BSD license](http://kohanaframework.org/license), so you can legally use it for any kind of open source, commercial, or personal project.

## What makes Kohana great?

Anything can be extended using the unique [filesystem](about.filesystem) design, little or no [configuration](about.configuration) is necessary, [error handling](debugging.errors) helps locate the source of errors quickly, and [debugging](debugging) and [profiling](debugging.profiling) provide insight into the application.

To help secure your applications, tools for [XSS removal](security.xss), [input validation](security.validation), [signed cookies](security.cookies), [form](security.forms) and [HTML](security.html) generators are all included. The [database](security.database) layer provides protection against [SQL injection](http://wikipedia.org/wiki/SQL_Injection). Of course, all official code is carefully written and reviewed for security.

## This Documentation Sucks!

We are working very hard to provide complete documentation. If you are having trouble finding an answer, check the [unofficial wiki](http://kerkness.ca/wiki/doku.php). If you would like to add or change something in the guide, please [fork the userguide](http://github.com/kohana/userguide), make your changes, and send a pull request. If you are not familar with git, you can also submit a [feature request](http://dev.kohanaframework.org/projects/kohana3/issues) (requires registration).
7 changes: 7 additions & 0 deletions guide/nl/about.mvc.md
@@ -0,0 +1,7 @@
# (Hierarchical) Model View Controller

Model View Controller (Or MVC for short) is a popular design pattern that separates your data sources (Model) from the presentation/templates (View) and the request logic (Controller).

It makes it much easier to develop applications as the system is designed to maximise the code reuse, meaning you don't have to write as much!

[!!] Stub
4 changes: 4 additions & 0 deletions guide/nl/about.translation.md
@@ -0,0 +1,4 @@
# Translation

[!!] This article is a stub!

0 comments on commit e3e9e89

Please sign in to comment.