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

Autocompletion for ZF2 view helpers in PhpStorm

Does anyone know if PHPStorm has some builtin support for view helper autocompletion or a possibility to write a plugin for it. I don't want to use inline var definitions for this as this would be cumbersome to do if I use a lot of view…
Bram Gerritsen
  • 7,178
  • 4
  • 35
  • 45
5
votes
2 answers

How to add custom view helpers to Zend Framework 2

I have earlier asked this question, and I got good answers there. However, that was for beta4, and no longer works. So where and how do I add my own view helpers to ZF2?
Matsemann
  • 21,083
  • 19
  • 56
  • 89
4
votes
3 answers

PHP Variable Scope and "foreach"

My application is building PDF documents. It uses scripts to produce each page's HTML. The PDF-Generating class is "Production", and page class is "Page". class Production { private $_pages; // an array of "Page" objects that the document is…
Niko Efimov
  • 2,183
  • 3
  • 20
  • 30
4
votes
5 answers

Zend Framework 2 Service in View Helper

I need to write a view helper that gets a service and do something with it. I successfully implemented the view helper to have access to the service locator. The problem is that the service I want to get is not being found through the service…
rafaame
  • 822
  • 2
  • 12
  • 22
4
votes
1 answer

In ZF2 how to make view functions to run in controller

I wanted the functionalities of view files to run in controller file also. For example, I wanted $this->escapeHtml() which runs in view file alone to run in controller through some means like $this->...->escapeHtml() Is this possible? Kindly help.
Beniston
  • 542
  • 1
  • 8
  • 17
4
votes
1 answer

Access parent view's variable from child view in Zend Framework 2

I'm using ZF2's View component as standalone for my project like this: $renderer = new PhpRenderer; $resolver = new Resolver\AggregateResolver(); $stack = new Resolver\TemplatePathStack(array( 'script_paths' => array( __DIR__ . '/view' …
cnkt
  • 2,943
  • 5
  • 30
  • 43
3
votes
1 answer

Zend Framework - clear a custom placeholder from a viewscript

I'm trying to clear a custom placeholder from a viewscript, let's say I have a controller plugin that creates a sidebar: $bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap'); $view = $bootstrap->getResource('view'); …
Dr. Dre
  • 149
  • 2
  • 10
3
votes
2 answers

Zend_Controller_Router_Route_Regex Optional Parameters with Reverse

I've successfully created my Route using Regex. I have Several Optional Parameters in my route that I don't want displayed in the URL Helper unless the user has specified them. How can I accomplish this? This is what I currently have …
user1287238
  • 31
  • 1
  • 3
3
votes
1 answer

How to render a parent and child active in a menu if they have the same URI and using Zend_Navigation?

Hello I'm digging into this problem without finding a solution. It seems very simple but I turn around for a while. I'm trying to highlight a parent and 1 child in a menu. Both have the same uri, but only the parent is getting the active class.…
FredRoger
  • 1,545
  • 1
  • 12
  • 17
3
votes
3 answers

Zend MVC:: How can javascript file + javascript code inserted to partial for head or body area?

How can javascript file + javascript code inserted to partial for head or body area? [Inside view simply call for insert to head to HeadScript and to body InlineScript - this not works inside partial(If I am wrong please write). ] Thanks, Yosef
Ben
  • 25,389
  • 34
  • 109
  • 165
3
votes
1 answer

Zend view in another view

I have a problem with Zend view . I wont to call a view in another view . How can I do it . Thanks.
Sardor
  • 157
  • 1
  • 8
3
votes
1 answer

Idea discussion: dynamic view script switching in zend MVC implementation

This is basically the "Am i doing it right?" question. I have an idea how i can transparently switch views for default/mobile version/admin areas at run time. And I would like to know what pros and cons you see in this approach. Main requirements…
Xerkus
  • 2,695
  • 1
  • 19
  • 32
3
votes
3 answers

Getting View Object from within a Zend Controller plugin

In my controller, I have a postDispatch to consolidate my FlashMessenger messages: public function postDispatch() { $messages = $this->_helper->getHelper ( 'FlashMessenger' ) ->getMessages (); if ( $this->_helper->getHelper (…
Corey
  • 1,977
  • 4
  • 28
  • 42
3
votes
3 answers

Does zend have an image view helper

I could type the html for an image in my view but was wondering if zend has an image view helper like it has with urls.
jblue
  • 4,390
  • 4
  • 46
  • 79
3
votes
2 answers

how to refer one .phtml in the other views in Zend

am new in Zend framework. I have one .phtml file, includes menus section. i need to add that .phtml file in to the views i.e views/scripts/index.phtml page. how can refer that please advice thanks in advance
venkat
  • 513
  • 2
  • 10
  • 16
1 2
3
19 20