0

My question is almost similar to this question. His goes 2 more directories deep and mine is just 1. That question was unanswered too.

This is the directory i wish to create:

classes
|--controller
  |--tests
    |--general.php

All i want to do is for a route to recognize that I'm accessing a controller in a subdirectory. Something like these:

localhost/stackoverflows/tests/general
localhost/stackoverflows/tests/general/index
localhost/stackoverflows/tests/general/lambda
localhost/stackoverflows/tests/general/lambda/parameter_1

I tried all the other solutions out there but nothing works. Not one tutorial. Or an answer to a question from a forum that was ACTUALLY tested. Even on the official kohana forum site. So i'm trying my luck here in SO.

Thanks in advance!

Community
  • 1
  • 1
jagc
  • 209
  • 3
  • 13

1 Answers1

0

To save a controller in that folder structure you should name your controller like Controller_Tests_General, and it should be placed in the folder /controller/tests/general. There you can create your actions. See example below.

Class Controller_Tests_General extends Controller
{

    public function action_index()
    {
        // your code here
        die('Do I end up here?');
    }

    public function action_lamdba()
    {
        // your code here
        // id should be defined in your bootstrap file as a Route to work like this.
        $parameter_id = $this->request->param('id');
    }
}
mrBrown
  • 153
  • 1
  • 10
  • Yyyyeah, that's exactly how my controller looks like. Just with an additional die. What i'm looking for is the correct routes code that would make kohana 3.2 recognize that i'm accessing action_lambda() because all i'm getting is an 'invalid url' error message. Thanks for your response, btw. – jagc Sep 16 '15 at 01:53
  • No problem. I don't know how to get the uri the way you want it. Although the controller is reached when your uri is /tests_general, /tests_general/index or /tests_general/lamdba. But that's not want you want right? – mrBrown Sep 16 '15 at 09:10