• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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.
Practical CodeIgniter 3  • CodeIgniter 4 Foundations - Coming Soon • Vulcan - CLI Tools for CI4
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.