Welcome Guest, Not a member yet? Register   Sign In
Sub Directory on Controller
#11

@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**
Reply
#12

(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
[Image: https://vulndetect.org/assets/uploads/fi...docker.ico]

Andy Biancoblu 

Quote:Once you have eliminated the impossible, whatever remains, however improbable, must be the truth.
Reply
#13

(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.
[Image: https://vulndetect.org/assets/uploads/fi...docker.ico]

Andy Biancoblu 

Quote:Once you have eliminated the impossible, whatever remains, however improbable, must be the truth.
Reply
#14

If you change the namespace to all first capital letters you need to also change the
directory name to first letter capital.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#15

Hi everyone.
Tried capital letters on folder and namespace.
Still not working. Any suggestion?
[Image: https://vulndetect.org/assets/uploads/fi...docker.ico]

Andy Biancoblu 

Quote:Once you have eliminated the impossible, whatever remains, however improbable, must be the truth.
Reply
#16

(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
[Image: https://vulndetect.org/assets/uploads/fi...docker.ico]

Andy Biancoblu 

Quote:Once you have eliminated the impossible, whatever remains, however improbable, must be the truth.
Reply
#17

(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?
[Image: https://vulndetect.org/assets/uploads/fi...docker.ico]

Andy Biancoblu 

Quote:Once you have eliminated the impossible, whatever remains, however improbable, must be the truth.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB