Can I change the location of view scripts in the Zend Framework?

Currently, view scripts for my Zend Framework application are in the application / views / scripts directory. Is it possible to change this location to what can be configured?

I assume this happens somewhere in the index.php file or in the application.ini file.

+4
source share
2 answers

For convenience, ZF automatically sets the script presentation path as the module /views/scripts/controller/action.phtml

You can add the script path through $view->addScriptPath('/path/to/view/scripts') , which will add this new path to the stack of available script paths. First, it checks the last set, then checks it until it finds a file.

Or you can reset the script path through $view->setScriptPath('/path/to/view/scripts')

If you need to do this for the controller, put this in your _init () method. If you need this for your entire application, I would recommend inserting it into your Bootstrap.

I believe this can also be placed in application.ini via: resources.view.basePath = "/path/to/views/"

See http://framework.zend.com/manual/en/zend.view.controllers.html

+10
source

I found a solution using partial guesses with the application.ini file. Here are two Entries that you can modify in Zend Framework 1.11.12.

 resources.layout.layoutPath = "/path/to/layouts/" resources.view.scriptPath = "/path/to/scripts/" 
+2
source

Source: https://habr.com/ru/post/1336520/


All Articles