Zend-expressive - render subdirectories

expressive

#1

Hello! I have a problem. My template configuration is:

'layout'    => 'layout::main',
        'paths'     => [
            'layout' => [
                ROOT_DIRECTORY . '/templates/layouts',
            ],
            'pages' => [
                ROOT_DIRECTORY . '/templates/pages',
            ],
            'error' => [
                ROOT_DIRECTORY . '/templates/errors',
            ],
        ],

In my Handler I writing

return new \Zend\Diactoros\Response\HtmlResponse(
            $this->templateRenderer->render('pages::home::index')
        );

And it doesn’t working.
I have structure like this:

templates/pages/home/index.php

Really it is necessary for each folder to register paths?


#2

You can just register templates once, then use templates:: inside your renderer call.