Using SubControllers?

Hi,

I am trying to access a simple subcontroller as follows: /modules/controller/action... I have seen the github example: https://github.com/phalcon/mvc/tree/master/simple-subcontrollers and I have attempted to follow it to a T, but I still get handler class cannot be loaded. It is even more weid because I am able to access it at work under my vagrant environment, but under my Gentoo environment at home it fails to load. I have everything setup correctly, that I know of, but I have no idea where the problem may lie. I am running PHP 5.3.10 at work and PHP 5.5.* on my Gentoo machine. I attempted to make sure the configs were as similar as possible, but still no luck! I ran into a similar issue with attempting to load the PHP DebugBar under the Phalcon loader. That didn't work so I used composer and it worked just fine.

Here is the relevant code:

.htaccess ```php RewriteBase /~tyler/mvc/

<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^$ public/ [L] RewriteRule (.*) public/$1 [L] </IfModule> ``` ```php RewriteBase /~tyler/mvc/

AddDefaultCharset UTF-8

<IfModule modrewrite.c> RewriteEngine On RewriteCond %{REQUESTFILENAME} !-d RewriteCond %{REQUESTFILENAME} !-f RewriteRule ^(.*)$ index.php?url=/$1 [QSA,L] </IfModule>

Routers

php $router->add('/modules/:controller/:action/:params', array( 'namespace' => 'MyApp\Controllers\Modules', 'controller' => 1, 'action' => 2, 'params' => 3, ));

$router->add('/modules/:controller', array( 'namespace' => 'MyApp\Controllers\Modules', 'controller' => 1 ));

$router->add('/modules/:controller/:action', array( 'namespace' => 'MyApp\Controllers\Modules', 'controller' => 1, 'action' => 2 )); ```

/**
* Dispatcher use a default namespace
*/
$di->set('dispatcher', function() {
    $dispatcher = new Dispatcher();
    $dispatcher->setDefaultNamespace('MyApp\Controllers');
    return $dispatcher;
});
<?php

namespace MyApp\Controllers\Modules;

use Phalcon\Mvc\Controller,
    Phalcon\Mvc\Dispatcher;

class ControllerBase extends Controller
{
    //Append software title to the title of each webpage
    public function initialize()
    {
        $this->tag->setTitle(' - ' . $this->config->application->softwareTitle);
    }

    public function beforeExecuteRoute(Dispatcher $dispatcher)
    {
        if (!$this->user->id){
            if ($dispatcher->getControllerName() != 'session') {
                return $this->response->redirect('login');
            }
        }
    }

}

<?php

namespace MyApp\Controllers\Modules;

use Phalcon\Mvc\Controller,
    Phalcon\Mvc\View;

class TestController extends ControllerBase
{
    public function testAction()
    {
       echo 'Hello';


    }

}

Thanks for any help!!!!

Nevermind I solved it of course after many hours of fiddling with it.

Added to the config file: ```php 'controllersmDir' => DIR . '/../controllers/modules/', ```

And to the loader: ```php 'MyApp\Controllers\Modules' => $config->application->controllersmDir, ```