Different layout in administration 24/04/2015

One-presenter administration, AdminPresenter.php Handful for simple and small administration. Directory structure <b>app/ models/ presenters/ AdminPresenter.php BasePresenter.php HomepagePresenter.php templates/ Admin/ default.latte Homepage/ default.latte @layout.latte</b> ← basic layout <b>@layoutAdmin.latte</b> ← admin layout <b>bootstrap.php</b> templates/Admin/default.latte <!-- use adminLayout.latte --> {layout "../@layoutAdmin.latte"} or we can modify structure like this: <b>templates/ Admin/ default.latte @layout.latte Homepage/</b> ... <b>@layout.latte</b> and template Admin/@layout.latte will load for AdminPresenter.php automatically. See automatic layout loader or AdminBasePresenter

One-presenter administration, AdminPresenter.php

Handful for simple and small administration.

Directory structure

<b>app/
    models/
    presenters/
        AdminPresenter.php
        BasePresenter.php
        HomepagePresenter.php
    templates/
        Admin/
            default.latte
        Homepage/
            default.latte
        @layout.latte</b>   ← basic layout
            <b>@layoutAdmin.latte</b>   ← admin layout
    <b>bootstrap.php</b>
  1. templates/Admin/default.latte

    <!-- use adminLayout.latte -->
    {layout "../@layoutAdmin.latte"}
    
  2. or we can modify structure like this:

    <b>templates/
        Admin/
            default.latte
            @layout.latte
        Homepage/</b>
            ...
        <b>@layout.latte</b>
    

    and template Admin/@layout.latte will load for AdminPresenter.php automatically. See automatic layout loader

  3. or AdminBasePresenter

    We still have @layoutAdmin.latte as in variant 1

    abstract class AdminBasePresenter extends BasePresenter
    {
        protected function beforeRender()
        {
            parent::beforeRender();
            $this->setLayout('layoutAdmin');
        }
    }
    

Modules – Front & Admin

Divide application to two separated modules with their own @layout.latte.

See MVC Applications & Presenters