Question

I am using zend 2 and I have the following in the module.config.php of Auth module:

<?php
return array(
    'controllers' => array(
        'invokables' => array(
            'Auth\Controller\Index' => 'Auth\Controller\IndexController',   
            'Auth\Controller\Registration' => 'Auth\Controller\RegistrationController',
            'Auth\Controller\Themes' => 'Auth\Controller\ThemesController',
            'Auth\Controller\Admin' => 'Auth\Controller\AdminController',   
        ),
    ),
   'router' => array(
        'routes' => array(
            'home' => array(
                'type' => 'Literal',
                'options' => array(
                    'route'    => '/',
                    'defaults' => array(
                        'controller' => 'Auth\Controller\Index',
                        'action'     => 'index',
                    ),
                ),
            ),
            'auth' => array(
                'type'    => 'Segment',
                'options' => array(
                    'route'    => '/auth',
                    'defaults' => array(
                        '__NAMESPACE__' => 'Auth\Controller',
                        'controller'    => 'Index',
                        'action'        => 'index',
                    ),
                ),
                'may_terminate' => true,
                'child_routes' => array(
                    'default' => array(
                        'type'    => 'Segment',
                        'options' => array(
                            'route'    => '/[:controller[/:action[/:id]]]',
                            'constraints' => array(
                                'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
                                'action'     => '[a-zA-Z][a-zA-Z0-9_-]*',
                                'id'         => '[a-zA-Z0-9_-]*',
                            ),
                            'defaults' => array(
                            ),
                        ),
                    ),
                ),
            ),
        ),
    ),
    'view_manager' => array(
         'template_map' => array(
             'layout/Auth'                  => __DIR__ . '/../view/layout/Auth.phtml',
             'application/layout/ajax-layout'   => __DIR__ . '/../view/layout/ajax-layout.phtml',
              'application/layout/normal-layout'   => __DIR__ . '/../view/layout/normal-layout.phtml',
             'auth/index/login'             => __DIR__ . '/../view/Auth/index/login.phtml',
             'auth/index/login-post'        => __DIR__ . '/../view/Auth/index/login-post.phtml',
             'auth/registration/registration-success' => __DIR__ . '/../view/Auth/registration/registration-success.phtml',
             'auth/registration/registration-failure' => __DIR__ . '/../view/Auth/registration/registration-failure.phtml',
             'auth/themes/creation-failure' => __DIR__ . '/../view/Auth/themes/creationFailure.phtml', 
             'auth/themes/create' => __DIR__ . '/../view/Auth/themes/createThemes.phtml',                
         ),
        'template_path_stack' => array(
            'auth' => __DIR__ . '/../view/'
        ),

        'display_exceptions' => true,
    ),
    'service_manager' => array(
        'aliases' => array(
            'Zend\Authentication\AuthenticationService' => 'my_auth_service',
        ),
        'invokables' => array(
            'my_auth_service' => 'Zend\Authentication\AuthenticationService',
        ),
    ),
);

When I put in the navigater the head folder name which is: test/ I get a blank page that contains nothing but these four words:

Auth Controller Index Action

Instead of the real page.

What is this? Who can help?

Was it helpful?

Solution

I solved it in the following way:

'router' => array(
        'routes' => array(
            'home' => array(
                'type' => 'Literal',
                'options' => array(
                    'route'    => '/',
                    'defaults' => array(
                        'controller' => 'Auth\Controller\Index',
                        'action'     => 'login',
                    ),
                ),
            ),

So that it will take its natural path:

Router -> Routes -> Home  

And route finds the way with only a slash:

'route' => '/'

And it defaults to :

'defaults' => array(
   'controller' => 'Auth\Controller\Index',
   'action'     => 'login',
),
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top