Welcome Guest, Not a member yet? Register   Sign In
Code module not setting up
#1

(This post was last modified: 08-28-2022, 02:27 PM by leafface.)

Hello,

I'm trying to set up a code module following the steps in the user guide.

1) I added the module to the psr4 section of the Autoload.php:
PHP Code:
public $psr4 = [
    APP_NAMESPACE      => APPPATH// For custom app namespace
    'Config'           => APPPATH 'Config',
 
   'Modules\YtVideos' => ROOTPATH 'modules/YtVideos'
]; 

2) Then I tried to add a route to the module's Routes.php:
PHP Code:
namespace Config;

$routes Services::routes();

$routes->get('admin/videos''Modules\YtVideos\Controllers\Admin_YtVideos::index'); 

This has no effect though, although the module's Routes.php gets loaded (error messages get thrown when something's wrong in it).

When I put the above route definition in the default Routes.php, I get the following error message:

Controller or its method is not found: \App\Controllers\Modules\YtVideos\Controllers\Admin_YtVideos::index

As you see, it looks for a Modules namespace inside the \App\Controllers namespace, although the Modules\YtVideos namespace is supposed to be handled as a root namespace.

What am I doing wrong?
Reply


Messages In This Thread
Code module not setting up - by leafface - 08-28-2022, 02:23 PM
RE: Code module not setting up - by iRedds - 08-28-2022, 02:49 PM
RE: Code module not setting up - by leafface - 08-29-2022, 03:10 AM
RE: Code module not setting up - by kenjis - 08-29-2022, 05:14 AM
RE: Code module not setting up - by leafface - 08-29-2022, 09:33 AM
RE: Code module not setting up - by kenjis - 08-29-2022, 06:39 PM
RE: Code module not setting up - by leafface - 08-30-2022, 06:07 AM
RE: Code module not setting up - by leafface - 08-30-2022, 07:46 AM
RE: Code module not setting up - by kenjis - 08-30-2022, 02:01 PM
RE: Code module not setting up - by leafface - 09-01-2022, 07:18 AM
RE: Code module not setting up - by InsiteFX - 08-31-2022, 12:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB