Creating an Assistant in Cohan 3.1

I follow the documentation at http://docs.kohanaphp.com/general/helpers . But these steps do not work in Cohan 3.1. I can not find documentation about the assistant in Cohan 3.1. how can i create my own helper class in kohan?

+5
source share
2 answers

There is no such thing as an assistant in Kohana 3 / 3.1

You create a class and use it, as usual, in a PHP application.

The only requirements are that the classes are in the directory classes, and the underscore in the class name is equal to the directory delimiters. for instance

class HTML_Helper

will be placed in

classes/html/helper.php

Then this is a simple example of using the class, as usual.

+8

!

Kohana 3.1.

http://kohanaframework.org/3.1/guide/kohana/helpers

, , .

. helper- , :

$foo = URL::base();

URL, APPPATH/application/classes/, url.php, :

class URL extends Kohana_URL {
    public static function bar()
    {
        // Do your magic
    }
}

:

$foo = URL::bar();

+12

All Articles