Welcome Guest, Not a member yet? Register   Sign In
How to make and include different routing files inside one route file?
#3

(04-17-2021, 12:41 PM)InsiteFX Wrote: Something like this for modules.

PHP Code:
app/Config/Routes.php 
//.. Other routes

// Add this to Footer 

// Including all module routes

$modules_path ROOTPATH 'Modules/';
$modules      scandir($modules_path);

foreach (
$modules as $module)
{
    if ($module === '.' || $module === '..')
    {
        continue;
    }

    if (is_dir($modules_path) . '/' $module)
    {
        $routes_path $modules_path $module '/Config/Routes.php';
    
        
if (file_exists($routes_path))
        {
            require $routes_path
        }
        else
        {
            continue;
        }
    }


Should get you going.
Would you please explain this code to me ?
Where should I put this code ?
Reply


Messages In This Thread
RE: How to make and include different routing files inside one route file? - by sr13579 - 04-17-2021, 04:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB