Questions tagged [zend-view]

provides the “View” layer of Zend Framework 2’s MVC system. It is a multi-tiered system allowing a variety of mechanisms for extension, substitution, and more.

The components of the view layer are as follows:

  • Variables Containers hold variables and callbacks that you wish to represent in the view. Often-times, a Variables Container will also provide mechanisms for context-specific escaping of variables and more.
  • View Models hold Variables Containers, specify the template to use (if any), and optionally provide rendering options (more on that below). View Models may be nested in order to represent complex structures.
  • Renderers take View Models and provide a representation of them to return. Zend Framework 2 ships with three renderers by default: a PhpRenderer which utilizes PHP templates in order to generate markup, a JsonRenderer, and a FeedRenderer for generating RSS and Atom feeds.
  • Resolvers utilizes Resolver Strategies to resolve a template name to a resource a Renderer may consume. As an example, a Resolver may take the name “blog/entry” and resolve it to a PHP view script.
  • The View consists of strategies that map the current Request to a Renderer, and strategies for injecting the result of rendering to the Response.
  • Rendering Strategies listen to the “renderer” event of the View and decide which Renderer should be selected based on the Request or other criteria.
  • Response Strategies are used to inject the Response object with the results of rendering. That may also include taking actions such as setting Content-Type headers.
290 questions
0
votes
1 answer

How to Extend Zend View Properly

In the view and layout scripts of my MVC application I regularly require access to convenience methods such as isLoggedIn() or isAdmin(). I would like to put these in a base view so that I can access them with $this->isLoggedIn() or…
DatsunBing
  • 8,684
  • 17
  • 87
  • 172
0
votes
2 answers

Multi navigation failed in layout

why second var_dump() display null in this code in my layout.phtml : var_dump(($this->navigation('navigation')->menu()->render())); var_dump(($this->navigation('navigation')->breadcrumbs()->render())); output : string '
Sina Miandashti
  • 2,087
  • 1
  • 26
  • 40
0
votes
1 answer

Zend Routing / URL helper . Have a global parameter show up first in URL

Was curious if anyone knew the best way to implement the following: I have a parameter in my zend framework 1.12 app which effectively controls the 'scope' of things, and is a field in every table in my db to represent the scope of a row. It is a…
0
votes
1 answer

Where is the implementation for the ->partial() method in Zend Framework?

I'm trying to find where Zend implemented the partial() method so that I can add some ACL code into it for permission control. I know that the calling object of the method is always a Zend_View object, and I looked, but the partial method seems to…
NightRaven
  • 401
  • 3
  • 17
0
votes
2 answers

zend framework 2 disable view for entire application

I'm currently developing the back-end application in Zend 2 and I need to disable view for entire application. I'll be more than happy if I can disable it on init stage. Is this possible? Thanks,
siuda
  • 33
  • 5
0
votes
1 answer

Zend Framework 2 - Set Template Path for Module

I googled alot and couldn't come up with an answer... I'm using the tutorial-skeleton application. It automatically includes under 'view/album/album' the html files corresponding to my actions like add or index. I'm using a submodule and the…
Ron
  • 22,128
  • 31
  • 108
  • 206
0
votes
1 answer

Zend Framework 2 - TemplatePathStack for several entities in module

A while ago I followed the tutorial and included the TemplatePathStack like it is described here. The tutorial suggests for the view directory a structure like view/album/album in which all the phtml-files lie. I wonder what's the reason for…
Ron
  • 22,128
  • 31
  • 108
  • 206
0
votes
2 answers

Zend default view script name switch

I want to display a mobile view instead of the normal view script. Let's take for example this action /my_module/my_controller/my_action. When I call it, based on some headers processing I know that user agent is a mobile device. Then I set the main…
0
votes
1 answer

Uncaught exception 'Zend_View_Exception' with message 'script 'error/error.phtml'

When I nave some exception in my Zend Framework application, I see this error message: Uncaught exception 'Zend_View_Exception' with message 'script 'error/error.phtml' not found in path (C:\wamp\www\my_app\application/views/)' in If I move…
0
votes
2 answers

zend error while assigning view

So installed the latest 2.0 version of Zend. I am having trouble in defining the view in controller and then displaying. If I create a new ViewModel and return it, it works fine. For example. public function __construct() { $this->view…
Micheal
  • 2,272
  • 10
  • 49
  • 93
0
votes
2 answers

zend framework 2 get locale from view PhpRenderer

How I can obtain traslator locale in my view? I want to do it starting from the variable $this (the PhpRenderer of the view). i.e. I don't want use onBootstrap nor ActionController because I don't care to have a view variables. Thank you!
0
votes
1 answer

Zend view , Plugin not found

i am creating email templates using the zend view class, and assigning variables.. i am also using helpers withing the view script file, but it has the errors when rendered: Message: Plugin by name 'EmTpl' was not found in the registry; used paths:…
dean jase
  • 1,161
  • 5
  • 23
  • 38
0
votes
1 answer

How to add Helpers to a PhpRenderer in Zend Framework 2.0?

I am migrating my old application to the new Zend Framework 2.0. My app uses it just as a library (no Zend\Application use or anything of the MVC part), and I have problems using the Form Helpers. So, I ended having 2 questions: How can I add a…
elxordi
  • 476
  • 3
  • 11
0
votes
0 answers

Not able to include files when use absolute path in zend framework

I am trying to use Zend_View but facing interesting issue, here is my code in controller. $view = new Zend_View(); $view->setScriptPath(APPLICATION_PATH . '/views/scripts/account/'); $view->render("add.phtml"); and in add.phtml I do have below…
kj007
  • 6,073
  • 4
  • 29
  • 47
0
votes
2 answers

zf2 cant render partial navigation

I'm trying to do ` $partial = array(DIR.'/menu.phtml', 'default'); echo $this->navigation()->menu()->setPartial($partial);` and im getting error Fatal error: Zend\View\Exception\RuntimeException: Zend\View\Renderer\PhpRenderer::render: Unable to…
Cawa
  • 1,269
  • 3
  • 25
  • 44