Bonjour à toutes et tous,

Je suis en train de débuter un nouveau projet, via Zend.
Voici le souci; actuellement, j'ai 2 modules:

  • Application
  • Admin


Et voici (en partie) les fichiers module.config pour chaque module:

  • Application

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
     
    namespace Application;
     
    return array(
        'router' =>
        [
            'routes' =>
            [
                'home' =>
                [
                    'type'    => 'Segment',
                    'options' =>
                    [
                        'route'    => '/',
                        'defaults' =>
                        [
                            'controller' => 'application.index',
                            'action'     => 'index',
                        ],
                    ],
                    'may_terminate' => true,
                ],
            ],
        ],
        'controllers' => array(
            'invokables' => array(
                'application.index' => 'Application\Controller\IndexController',
            ),
        ),
        'view_manager' =>
        [
            'display_not_found_reason' => true,
            'display_exceptions'       => true,
            'doctype'                  => 'HTML5',
            'not_found_template'       => 'error/404',
            'exception_template'       => 'error/index',
            'template_map' =>
            [
                'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
                'error/404'     => __DIR__ . '/../view/error/404.phtml',
                'error/index'   => __DIR__ . '/../view/error/index.phtml',
                'application/index/index' => __DIR__ . '/../view/application/index/index.phtml',
            ],
            'template_path_stack' =>
            [
                __DIR__ . '/../view',
            ],
        ],
    );
  • Admin

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
     
    return [
        'router' =>
        [
            'routes' =>
            [
                'home' =>
                [
     
                    'child_routes' =>
                    [
     
                        'admin' =>
                        [
                            'type'    => 'Segment',
                            'options' =>
                            [
                                'route'    => '/admin',
                                'defaults' =>
                                [
                                    'controller' => 'admin.index',
                                    'action'     => 'index'
                                ],
                            ],
                            'may_terminate' => true,
                            'child_routes'  =>
                            [
                                'post' =>
                                [
                                    'type'    => 'Segment',
                                    'options' =>
                                    [
                                        'route'   => '/post[/:action][/:id]',
                                        'default' =>
                                        [
                                            'controller' => 'admin.post',
                                            'action'     => 'index',
                                        ],
                                        'constraints' =>
                                        [
                                            'action' => 'index|edit|create',
                                            'id'     => '[0-9]+',
                                        ],
                                    ],
                                    'may_terminate' => true,
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ],
        'controllers' =>
        [
            'invokables' =>
            [
                'admin.index' => 'Admin\Controller\IndexController',
                'admin.post'  => 'Admin\Controller\PostController'
            ],
        ],
        'view_manager' =>
        [
            'display_not_found_reason' => true,
            'display_exceptions'       => true,
            'doctype'                  => 'HTML5',
            'not_found_template'       => 'error/404',
            'exception_template'       => 'error/index',
            'template_map' =>
            [
                'layout/layout'     => __DIR__ . '/../view/layout/layout.phtml',
                'error/404'         => __DIR__ . '/../view/error/404.phtml',
                'error/index'       => __DIR__ . '/../view/error/index.phtml',
            ],
            'template_path_stack' =>
            [
                __DIR__ . '/../../view',
            ],
        ]
    ];


La racine de mon projet est défini dans ma config vagrant, est est local.blog.
Et c'est ici que les soucis arrivent:

  1. Si j'accède à l'URL local.blog, je me retrouve avec le layout de l'admin...
  2. Si j'accède à l'URL local.blog, je suis toujours sur le layout de l'admin, mais le contenu affiche une 404: "the requested URL could not be matched by routing.


Je pense donc avoir loupé quelque chose dans la configuration du routing, mais je ne suis pas certaine.
Dernière question: dans le layout du module application, comment faire un lien vers ADMIN? Le lien ci-dessous ne semble pas fonctionner..
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
 
<a href="<?php echo $this->url('home/admin'); ?>">
ADMIN
</a>
Grand merci pour l'aide que vous pourrez m'apporter