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
3
votes
1 answer

Zend Expressive: how to change layout using Zend View

Zend Expressive defaults to layout template when using Zend View. I note the addTemplate($template) function in PhpRenderer class but where and how to add an alternative template to layout? In a middleware factory of an action, in the action itself,…
Mike A
  • 39
  • 7
3
votes
1 answer

ZF2: Using Zend\View to render emails

In ZF1, I used the view component to render email templates as follows: $html = new Zend_View(); $html->setScriptPath($path); $html->assign($vars); $body = $html->render($template); // prepare the mail $mail = new…
DatsunBing
  • 8,684
  • 17
  • 87
  • 172
3
votes
2 answers

How to access route, post, get, server etc parameters from view file in Zend Framework 2

How can we access route, post, get, server parameters from VIEW file in ZF2 way? Here I found the almost same question but no where mentioned about view nor answered anywhere Thanks
Sanju
  • 401
  • 3
  • 7
  • 15
3
votes
1 answer

Launching a custom view from a custom model. Zend_possible?

You have to promise not to giggle, but my situation is following: Instead of using partials and helpers and other similar tools that we use already, we want to use a custom view outside all frames and borders of the actual application. Basically, we…
John
  • 261
  • 1
  • 3
  • 16
3
votes
1 answer

Zend View Helper Navigation removes active branch so breadcrumbs don't show up

Hey I want a layout in my header where I have the global menu, then the page menu and then breadcrumbs. To do this I, mostly, took away from this answer: Rendering Active Branch of Zend Navigation Without Top Level This works great, except the…
Penetal
  • 83
  • 2
  • 6
3
votes
4 answers

Zend Framework with JavaScript libraries

I have been working with Zend Framework for a few months now. I have so far been succesfully using some view helpers, action helpers and partials. Now i have come across some javascript libraries i want to use in my project such as TinyMCE and…
Björn
  • 203
  • 6
  • 19
3
votes
1 answer

Zend view script path setup

Here is the code I have: $this->getView()->setScriptPath($templatePath); $this->_helper->viewRenderer($page); This code is handled in the Core_PageController view action. The problem I have is now the view object looks for my script files in…
somejkuser
  • 8,856
  • 20
  • 64
  • 130
2
votes
1 answer

Zend escape() function doesn't work

I am doing a tutorial according to this article. This is basic Hello World! example using Zend Framework. When I am looking at the output on my browser it shows me escape($this->title);. I don't get the problem. Why Zend escape() function don't…
John Nancy
  • 33
  • 4
2
votes
1 answer

zend framework cannot find helper view file. Get 'Plugin by name was not found' error

I am trying to simply use a custom view helper that is located in /library/my/view/helpers/friends.php I have this in the application.ini: resources.view.helperPath.My_View_Helper = "/my/view/helpers" This is the helper class: class…
Andy N
  • 1,013
  • 9
  • 25
2
votes
1 answer

Template engine for PHP + JS but

I'm building a web app that relies fairly heavily on Ajax for its interactivity, and I want to get around the problem of having two versions of my HTML templates, to keep things DRY. I came across a question here, template engine both for JS and…
Adam
  • 5,091
  • 5
  • 32
  • 49
2
votes
1 answer

Zend_View caching (Redis)

Task: During the process of action of Zend Application to achieve next: - for each unique url or any definite url to substitute Zend_View object by data stored in the cache (Zend_View object ) and not to perform Action - if data in cache is null,…
aimodify
  • 429
  • 1
  • 6
  • 11
2
votes
4 answers

how to build query string in zend framework?

I'm trying to build a query string as following: I want to add an array to query string. For example, array('find_loc'=>'New+York', 'find_name'=>'starbucks') I…
Vlad Vinnikov
  • 1,457
  • 3
  • 22
  • 33
2
votes
1 answer

How does zend view render resolve path to view script

How does an action like this "customSearchAction()" map to the view script file name. Neither of these file names work "customsearch.xml.phtml", "customSearch.xml.phtml", "custom-search.xml.phtml". Please, note that I am using context switching view…
krishna
  • 3,547
  • 5
  • 27
  • 29
2
votes
2 answers

Automatic variable escaper for Zend Framework

Can you recommend any good solution for automatic view variable escaping for Zend Framework 1.x? I have tried so far: ZF2 implementation; looks like it does not escape variables syntax like this: $this->var->object()->string gnix-view, very nice,…
takeshin
  • 49,108
  • 32
  • 120
  • 164
2
votes
1 answer

Where should I locate logic related to layout in Zend Framework?

I need to customize the attributes of my body tag. Where should I locate the logic? In a Base Controller, view Helper ? This should be the layout doctype() ?> ... …
texai
  • 3,696
  • 6
  • 31
  • 41