CodeIgniter Forums

Full Version: Sub Directory on Controller
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
@andybiancoblu Are you getting an error message? E.g. 404 Not Found.

I don't *think* it would matter but you should try uppercase on your namespace: `App\Controllers\Dashboard`

Also make sure auto-routing is enabled (should be if you didn't change anything) in **app/Config/Routes.php**
(09-24-2019, 08:34 AM)MGatner Wrote: [ -> ]@andybiancoblu Are you getting an error message? E.g. 404 Not Found.

I don't *think* it would matter but you should try uppercase on your namespace: `App\Controllers\Dashboard`

Also make sure auto-routing is enabled (should be if you didn't change anything) in **app/Config/Routes.php**

Hi @MGatner,
yeah, I'm getting 404 error.
The only way to make it work was to add a route through $routes->add... Mapping subdir, controller and method, but I don't think that's the way of doing stuffs in CI4.
I'm running CI4 rc1 on a docker container, filesystem permissions are ok.
app/Config/Routes.php was modified only to set a default controller (which didn't work). To get it work i modified $routes->get('/', 'Class::method')

I'm trying right now to change to uppercase namespace. I did it like that cause I saw the guy who started the post that didn't use uppercase for namespacing the subdir.

Thanks a lot for the reply, I'm going to update you soon.

Andy
(09-24-2019, 09:29 AM)andybiancoblu Wrote: [ -> ]
(09-24-2019, 08:34 AM)MGatner Wrote: [ -> ]@andybiancoblu Are you getting an error message? E.g. 404 Not Found.

I don't *think* it would matter but you should try uppercase on your namespace: `App\Controllers\Dashboard`

Also make sure auto-routing is enabled (should be if you didn't change anything) in **app/Config/Routes.php**

Hi @MGatner,
yeah, I'm getting 404 error.
The only way to make it work was to add a route through $routes->add... Mapping subdir, controller and method, but I don't think that's the way of doing stuffs in CI4.
I'm running CI4 rc1 on a docker container, filesystem permissions are ok.
app/Config/Routes.php was modified only to set a default controller (which didn't work). To get it work i modified $routes->get('/', 'Class::method')

I'm trying right now to change to uppercase namespace. I did it like that cause I saw the guy who started the post that didn't use uppercase for namespacing the subdir
Ho again.
Tried ti uppercase namespace in my classe. No effect.
If you change the namespace to all first capital letters you need to also change the
directory name to first letter capital.
Hi everyone.
Tried capital letters on folder and namespace.
Still not working. Any suggestion?
(09-24-2019, 08:34 AM)MGatner Wrote: [ -> ]@andybiancoblu Are you getting an error message? E.g. 404 Not Found.

I don't *think* it would matter but you should try uppercase on your namespace: `App\Controllers\Dashboard`

Also make sure auto-routing is enabled (should be if you didn't change anything) in **app/Config/Routes.php**

(09-25-2019, 02:47 AM)InsiteFX Wrote: [ -> ]If you change the namespace to all first capital letters you need to also change the
directory name to first letter capital.
Hi again.
This is my 404:

404 - File Not Found

Controller or its method is not found: {0}::{1}

are those {0}::{1} relevant?
Seems to me like CI is not reading correctly the request
(09-24-2019, 08:34 AM)MGatner Wrote: [ -> ]@andybiancoblu Are you getting an error message? E.g. 404 Not Found.

I don't *think* it would matter but you should try uppercase on your namespace: `App\Controllers\Dashboard`

Also make sure auto-routing is enabled (should be if you didn't change anything) in **app/Config/Routes.php**
Hello again.
I'm desperate! I really want to start developing a project with CI4 because I find it really robust as a framework, but this issue with subfolders is blocking me.

Consider my Routes.php:
Code:
<?php namespace Config;

$routes = Services::routes(true);
if (file_exists(SYSTEMPATH . 'Config/Routes.php'))
{
    require SYSTEMPATH . 'Config/Routes.php';
}

$routes->setDefaultNamespace('App\Controllers');
$routes->setDefaultController('Dashboard');
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(false);
$routes->set404Override();
$routes->setAutoRoute(true);

$routes->get('/', 'App\Controllers\dashboard\Dashboard::index');

if (file_exists(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php'))
{
    require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
}
I omitted deafault comments...

What's wrong with my configuration?
I tried recreating virtualhost config to check if there was something wrong there, but nothing worked.

Can anyone help?
Pages: 1 2