ZF2 - Zend framework 2, Showing a login template -


In ZF2, we can set our controller in the application controller:

  'Layout / Layout '= & gt; __DIR__ '/../theme/metronic/view/layout/layout.phtml', 'Applications / Index / Index' = & gt; __DIR__ '/../theme/metronic/view/application/index/index.phtml', 'Error / 404' = & gt; __DIR__ '/../theme/metronic/view/error/404.phtml', 'Error / Index' = & gt; __DIR__ '/../theme/metronic/view/error/index.phtml',   

In case of code compatibility it is really useful.

My special template is completely different from one admin theme and login page normal layout pages. Of course, I do not want the admin to appear on the side menu login page ...

Normal pages look like this:

And the login page looks like this:

I have written my login module but I do not know how to override the normal layout / layout page.

I still keep in touch with ZF2 routing and I think what I should do is enter the correct path for the login template ... The second option is to access the login url Layout / layout template for rendering and serving alternative templates. Some code has been put in file file.

Am I missing something here?

I have received the answer and it is relatively simple although the documentation is not easy.

Follow the basic steps:

  1. Clone the GIT clone in your vendor folder
  2. Enable in application.config.php:

    'module' = & gt; Array ('app', 'adm module layout'),

  3. Add layout to your application / module.config.ff file. It's mine:

      'view_manager' = & gt; Array ('display_not_found_reason' = & gt; true, 'display_exceptions =' = & gt; true, 'doctype' = & gt; 'html5', 'not_found_tileplate' = & gt; 'error / 404', 'exception_template '= & Gt;' Error / Index ',' Template_map '= & gt; Array (' Login / Layout '= & gt; __DIR__.' /../view/login/login.phtml ',' Layout / Layout ' = & Gt; __DIR__. '/../view/layout/layout.phtml', 'Applications / Index / Index' => __DIR__ ./../view/application/index/index.phtml 'Error' / 404 '= & gt; __DIR__.' / .. /view/error/404.phtml ',' Error / Index '= & gt; __DIR__.' /../view/error/index.phtml ',), 'Template_path_stack' = & gt; array (__DIR__. '/. /',),), // a custom l Use it to set out 'module_layouts' = & gt; Array ('login' = & gt; 'login / layout',),      

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -