Returning View without pagekit frame

  • Hey,


    one new question:

    Is it possible to create an method in my site-controller that renders a view without the template frame arround?

    I need to generate an view without menu, footer, etc... is that possible with pagekit?

  • Template-frame...? You mean without parsing it to the active template?

    Well - yes, it is :)


    PHP: MyController.php
    1. $response = App::view('foo/bar:views/your/almost-blank-page.php', compact('config'));
    2. return App::response()->create($response, 200);



    You could even do that inline:

    PHP: MyController.php
    1. $response = "Hello World";
    2. return App::response()->create($response, 200);
  • How would you realize this szenario?


    I need do create a website with two different themes. One theme, the "Main Theme" should be visible to all visitors of the Page. When a user with an specific role is logged in , an "Admin Template" has to be shown. It should have an own menu, an different styling, etc... Is that possible to realize?

  • For the original question, the simplest answer can be found here at the end:


    Quote

    This view is wrapped in the main layout by default. To avoid this behavior, you can change 'layout' => false in the $view array.

    Expamle:

    The LORD is my strength and my shield; in him my heart trusts, and I am helped; my heart exults, and with my song I give thanks to him. Psalm 28,7

  • Take a look in pagekit/app/system/index.php from line 128


    PHP
    1. 'view.init' => function ($event, $view) use ($app) {
    2. $theme = $app->isAdmin() ? $app->module('system/theme') : $app['theme'];
    3. $view->map('layout', $theme->get('layout', 'views:template.php'));
    4. $view->addGlobal('theme', $app['theme']);
    5. },

    Probably you can create a listener and dynamicly change the global of the view ;)

    The LORD is my strength and my shield; in him my heart trusts, and I am helped; my heart exults, and with my song I give thanks to him. Psalm 28,7