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
8
votes
3 answers

Display label before input using formRow view helper in Zf2

In Zend Framework 2.1.4 I am using the standard form view helpers to render out my form elements. When I try: formRow($form->get('Title'));?> The label text and input element are placed within the…
lukabers
  • 189
  • 2
  • 11
8
votes
4 answers

Zend Framework: Render multiple Views in one Layout

I want to generate a dynamic site using Zend_Layout. My layout (/application/layouts/scripts/layout.phtml) contains the following lines: ... render('header.phtml') ?>
Michi
  • 223
  • 1
  • 2
  • 6
8
votes
4 answers

Zend different view scripts?

I have a controller that passes input from a form into a model class to perform validation. If the validation is successful I want to allow the flow to continue and render the default view associated with the controller. My issue is that if…
db83
  • 169
  • 1
  • 4
  • 13
7
votes
1 answer

What is a Zend View Filter?

What is a Zend View Filter? I see them mentioned in the ZF1 documentation, http://framework.zend.com/manual/1.12/en/zend.view.introduction.html, and in the Zend_View code, but I can't find an explanation for them. Perhaps it is to support other…
DatsunBing
  • 8,684
  • 17
  • 87
  • 172
7
votes
1 answer

Zend Framework 2 - How to include partial from library

I wrote a partial which I want to use in several modules. I thought the best way would be to put it into my custom library. But unfortunately I couldn't figure out a way to include this partial without using a very ugly path like: echo…
Jonas
  • 302
  • 2
  • 13
6
votes
4 answers

masking credit card & bank account information

I'm looking for a php function which can mask credit card & bank information such as routing number and account numbers. I need to mask many formats, so the existing stack overflow answers don't help me that much. So for example, if the input is…
aporat
  • 5,922
  • 5
  • 32
  • 54
6
votes
3 answers

Zend_View_Helper vs Zend View Partial Script

This is my fork in the road. I want to display some sort of button on my webpage and I want to do it in many places. This 'button' is really just gonna act like a link to some other page and all the button instances are gonna go to one page. I want…
Jerry Saravia
  • 3,737
  • 3
  • 24
  • 39
6
votes
2 answers

How to use Zend Framework's Partial Loop with Objects

I am quite confused how to use partialLoop Currently I use foreach ($childrenTodos as $childTodo) { echo $this->partial('todos/_row.phtml', array('todo' => $childTodo)); } $childrenTodos is a Doctrine\ORM\PersistantCollection, $childTodo is a…
Jiew Meng
  • 84,767
  • 185
  • 495
  • 805
6
votes
2 answers

Set custom template path to render instead of standard one

Is it possible in ZendFramework to set custom template when I call some action ? For example I call /category/show/id/123 and View is rendering /category/show.html file. I want to be able to render anonther template - /category/showOther.html. What…
hsz
  • 148,279
  • 62
  • 259
  • 315
6
votes
3 answers

How to Access Application Config from View in Zend Framework 2 (zf2)?

I wanted to access the application config from a view. How can I achieve that in ZF 2?
Omar
  • 8,374
  • 8
  • 39
  • 50
6
votes
7 answers

ZF2 - How to change the error/404 response page? Not just template but to set a new ViewModel

By default the page is set like this in the Application module.config array: 'template_map' => array( 'error/404' => __DIR__ . '/../view/error/404.phtml' I want to change the page. I want new ViewModel for it full of variables. It means that…
Green
  • 28,742
  • 61
  • 158
  • 247
5
votes
1 answer

Creating a form view in Zend

Is there a reliable way to create a custom view for a Zend_Form? The decorators are pretty cryptic and using them in fancy ways sometimes is so complicated that I'd prefer to just write the HTML by hand. Is there a way to do it and still make the…
mingos
  • 23,778
  • 12
  • 70
  • 107
5
votes
1 answer

zend view: bootstrap(view) or bootstrap(layout)

These are 2 different implementations for an _init function in the bootstrap related to bootstrapping the view. One gets at the view right away: bootstrap('view') then gets it as a resource $this->bootstrap('view'); $view =…
jblue
  • 4,390
  • 4
  • 46
  • 79
5
votes
4 answers

Where do I put view scripts needed by view helpers (using Zend_View and the default directory layout)?

I've got a relatively complicated portion of my application, which is an editor for access control lists. I need to reuse it in a few places, and I'd like it to be loadable all ajax-y and such. Because I need to use it often, I'd like to make it…
Billy ONeal
  • 104,103
  • 58
  • 317
  • 552
5
votes
3 answers

zend_form ViewScript decorator / passing arguments

I have a form that is extend from Zend_Form. I am placing the form into a ViewScript decorator like this: $this->setDecorators(array(array('ViewScript', array('viewScript' => 'game/forms/game-management.phtml')))); I'd like to pass in a variable to…
timpone
  • 19,235
  • 36
  • 121
  • 211
1
2
3
19 20