user2115883
user2115883

Reputation: 17

Kohana - Need advice about routing

application
modules
   myModule
      classes
         controller
         model
         helper
         foo.php
      views
      init.php

This is the file structure of my module. I need to create route inside of init.php, that will allow me to call foo.php file from anywhere in the project. The class in foo.php does not extend any kohana classes - that's the place stopping me.

Could you help me?

Upvotes: 0

Views: 144

Answers (2)

zombor
zombor

Reputation: 3257

Routing applies to controllers, not random classes. As long as you register the module, the class will be autoloaded whenever you do new Foo;. They don't need to extend kohana classes to be autoloaded.

Upvotes: 1

dzeno
dzeno

Reputation: 510

Try with: include Kohana::find_file('classes', 'foo'); and don't forget to enable your module in bootstrap.php: 'myModule' => MODPATH.'myModule'.

Upvotes: 0

Related Questions