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
2
votes
2 answers

trying to show a variable in my layout

i have a simple question where is my code wrong ? in index controller and index action i put $this->view->username="user1"; and when i try in my layout i use echo $this->username; i got fllowing error or null value Notice: Trying to get…
user1400
  • 1,411
  • 4
  • 26
  • 36
2
votes
1 answer

Extending Zend View Helper Placeholder

I was reading the manual about basic placeholder usage, and it has this example: class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { // ... protected function _initSidebar() { $this->bootstrap('View'); $view =…
Sonny
  • 8,204
  • 7
  • 63
  • 134
2
votes
2 answers

Zend framework 2: Nested view with template from other module

How can I set template from other module in Zend Framework 2? I have two modules: - module "A" (It's my main theme) - module "B" (It's kind of plugin/widget) I would like to in module "A" set template of module "B". I tried: public function…
user1409508
  • 623
  • 1
  • 12
  • 38
2
votes
1 answer

Modify Stack in the Zend HeadScript View Helper

I am trying to attack this problem from a completely different angle, because it doesn't look like I can achieve my goal that way. I want to loop over the item stack in the HeadScript View Helper, and make modifications to it. The documentation for…
Sonny
  • 8,204
  • 7
  • 63
  • 134
2
votes
1 answer

multiple instances of view helper plugin?

How do I instantiate multiple instances of a view helper plugin in Zend 2? I want to return a new instance every time I call $this->pluginName(); from the view. How do I return a new instance of the view plugin?
Victor Odiah
  • 1,061
  • 11
  • 14
2
votes
2 answers

Searching for a javascript function definition within a string using PHP?

I'm using Zend_View_Helper_HeadScript to display javascript function definitions in the head of my webpages, and I extended it to get the javascript code from file if desired. What I'd like to know is if there would be an easy way to search the…
2
votes
1 answer

Using PhpRenderer directly with child views in ZF2

When sending out e-mails in Zend Framework 2, I want to use view script templates such that I can leverage a layout for my various e-mail templates. The idea is that I have a layout which has the shared markup and echoes out content somewhere.…
ba0708
  • 10,180
  • 13
  • 67
  • 99
2
votes
1 answer

Zend Framework: Allowing Meta Properties for the HTML5 Doctype (Facebook Open Graph)

I am using the HTML5 doctype in my Zend Framework application. If I use XHTML1_RDFA as my doctype, the headMeta view helper allows me to use the appendProperty() function. I know that meta properties are not valid in HTML5, but I want to do it…
Sonny
  • 8,204
  • 7
  • 63
  • 134
2
votes
2 answers

How to show images on zend framewrok from index view?

I am new to zend framewrok. I am trying to show an image from index view. Below is my code: headTitle($this->title); ?>

2
votes
1 answer

Zend Form - View helper and form decorator

What is the difference between a zend form decorator and a view helper? I want to use some awesome Jquery plugins for my form but finding hard to understand about decorators and view helpers, for example the following is the Twitter bootstrap CSS…
2
votes
3 answers

Google's CDN in Zend Framework

How can I get Google's CDN with fallback working in Zend Framework(Zend_View)?