Noah Goodrich
Noah Goodrich

Reputation: 25263

How to Use Module Controllers in Kohana 3?

For the following application directory structure under / in Kohana 3:

And the urls be: /controller1 and /admin/controller2?

I seem to be missing something though because I keep getting a 404 error with the /admin/controller. What am I doing incorrectly?

The exact error is:

HTTP_Exception_404 [ 404 ]: The requested URL admin/borrowers was not found on this server.

And I don't have any custom routes setup. This is a very vanilla K3 install at this point.

Upvotes: 1

Views: 1192

Answers (1)

Ikke
Ikke

Reputation: 101221

The directory structure seems to be a little of.

Using a module doesn't automatically means you have a subdirectory. The default route defines the following url structure:

/[controller]/[action]

So for the directory structure that you have given, you get the following:

/controller2/

The action can be left out, but it will default to index.

If you want a special admin subdirectory, you would first have to create that subdirectory in you modules classes directory like this:

/admin/classes/admin/controller2.php

Then you would have to add another route that handles the subdirectory. You can find more information about that in the userguide

Upvotes: 2

Related Questions