-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modules Controllers sub-directory problem #322
Comments
What namespace did you use in your controller? |
Acme Namespace; $routes->setDefaultNamespace('Acme\Controllers'); localhost/ci4/test/foo - 404 Modules in controllers sub-directory auto route problem. |
For file |
Current Site\Controllers\Auth\Auth Controller; |
It looks like you've got things setup correctly. I'll have to dig into the code and see what's going on. |
I take that back. Auto-Routing currently only works in APPATH.Controllers, which is why it's not working for you. However, it definitely makes sense the way you're trying to use it. I'll work on that. |
And I must be rusty. :) While it doesn't look like it should work, because the full namespace is set on line 465 of Router.php, it all works as expected. Here's the steps I did so that you can reproduce:
If I try to access Looking back at your files, your second set of files had a different namespace, etc, but you did not provide your routing settings, so you might have missed something there. |
Hello, setAutoRoute(true); // not working module sub-directory.
|
Sorry you couldn't get the Auto-Route working, but the more explicit method there will definitely work for you. I was unable to recreate a broken system so there's nothing I can do at this time. |
Hello, i have followed your steps in your previous post and I have some issues getting response for anything other than the home Once I add other routes to the same controller and method, i get 404'd
The Thanks |
I can't look until later tonight, but typically you would not put the leading slash on a segment, so you might try like this:
This is not really relevant to this issue, though, since this issue was about the Auto-Routing feature. |
@lonnieezell It was that. I'm very sorry to have bothered you with such a simple question. But after several hours tinkering that detail escaped me. Thank you very much |
No worries. And that's something I'll need to look at since it should still work there. Thanks. |
you make folder out of controller add base controller path through namespace could and go to route change default route type this |
Hi,
test types;
Acme\Controllers\Test\Foo.php;
access localhost/ci4/acme/test/foo, localhost/test/foo;
$routes->setDefaultNamespace('Acme\Controllers');
$routes->setDefaultController('');
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(false);
$routes->set404Override();
$routes->setAutoRoute(true);
non sub-directory method running.
Acme\Controllers\Test - in foo() method;
access localhost/ci4/test/foo;
AutoRoute problem.
custom add routes running, test route;
$routes->add('sample', 'Acme\Controllers\Test\Foo::sample'); // only sample method.
The text was updated successfully, but these errors were encountered: