Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Calling Specific View

Is there a way to call specific view inside a function ? Like in CodeIgniter you have something like $this->load->view('somedir/someview', $data);



56.6k
Accepted
answer

The view object is stored in the Dependency Injector (DI), and can therefore be accessed the same as anything else in the DI. It's not clear in what context the function resides (ie: Model? Controller?) and the specific code to access stuff in the DI will vary.

However, once you have the View object, you do have access to all the functionality of the View object. I'm not sure what you mean by "call a specific view", but it is possible to force the rendering of a specific view template file. Look at the documentation for the View functionality, specifically "picking a view" http://docs.phalconphp.com/en/latest/reference/views.html#picking-views



10.4k

Yeah, picking-views is what I needed :-) Thanks.