Welcome Guest, Not a member yet? Register   Sign In
Scan for any Routes.php file within modules doesn't work
#1

application/Config/Routes.php


PHP Code:
/**
 * Load routes files from all defined namespaces in Config\Autoloader.php
 */
$files service('locator')->search('Config/Routes.php');

foreach (
$files as $file)
{
 
   include_once $file;



In my windows.

Just found two files: system/Config/Routes.php and application/Config/Routes.php

Below, my structure directories.
Code:
application/
modules/
.. news/
.. .. Config/
.. .. ..Routes.php
application/config/Autoload.php

PHP Code:
        $psr4 = [
            
'Config'                     => APPPATH.'Config',
            
APP_NAMESPACE                => APPPATH,            // For custom namespace
            
'App'                        => APPPATH,            // To ensure filters, etc still found
            //'Modules'                    => APPPATH . '../modules',
            
'Modules'                    => ROOTPATH 'modules',
        ]; 
Sorry for my English...
Reply
#2

That's because the namespace points to ROOTPATH/modules. So it's looking for ROOTPATH/modules/Config/Routes.php. You'll need to add a namespace for each "module" for it to work.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB