ZF2: How can I set basePath to be the same for a whole application?
Asked Answered
C

1

1

The manual's example shows how to set the basePath only for some specific viewModel:

$this->getHelper('basePath')->setBasePath()

But I want to set it somewhere in one place and then it is the same for any viewModel I create in any Controller. How can I do it?

Cianca answered 19/12, 2012 at 15:17 Comment(0)
K
10

You could set a global base path in config:

'view_manager' => array(
    'base_path' => '/path/'
)
Kisangani answered 20/12, 2012 at 2:44 Comment(2)
Thank you vary much, it works. But how do you know that there is such a key/value pair? Here's an example from the manual how the view_manager config has to look like and there is no such a key base_path zf2.readthedocs.org/en/latest/modules/…. Where is it possible to see all possible keys for view_manager and other services?Cianca
Actually I read source codes for most times because zf2 documents are not very completely yet. You could try to grep 'view_manager' in zf2 project and will get all possible keys.Kisangani

© 2022 - 2024 — McMap. All rights reserved.