1

EDIT : I've found what i wanted, and config-based solution. If it can help other like me here is the link :

The article

It works fine :)


i'm using Zend framework to create websites. I would like to create an administration zone but i'm stuck with a layout problem.

So here is my problem :

In my Admin module, i've modified my module.config.php, like so :

'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',
            'admin/index/index' => __DIR__ . '/../view/admin/admin/index.phtml',
            'error/404'               => __DIR__ . '/../view/error/404.phtml',
            'error/index'             => __DIR__ . '/../view/error/index.phtml',
        ],
        'template_path_stack' => [
            __DIR__ . '/../view',
        ],
    ],

and created a folder layout with a fil layout.phtml in my module.

I've changed my Application's module.config.php like so :

'view_manager' => [
        'template_path_stack' => [
            'application' => __DIR__ . '/../view',
        ],
    ],

My Application's layout.phtml is empty and my Admin's layout.php is'nt.

So when i'm in zend-cms.localhost/admin, it's all good, my layout is fine and everithing works but when i'm in zend-cms.localhost/, my admin layout is still here. I've search a everywhere andevery solutions i could find where unsuccessful. I can't see what i'm doing wrong ! Any ideas ?

Thanks for your help guys :)

  • This may help: http://stackoverflow.com/questions/1615956/how-to-switch-layout-files-in-zend-framework. It is a procedural process as opposed to a config-based solution however. – Curtis Kelsey Mar 29 '17 at 13:36
  • Thanks for your answer Curtis, i've finally managed to do what i wanted :) with a config-based solution :) i will edit my post to close it ! – Maxime Guiton Mar 29 '17 at 17:40

0 Answers0