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

ZF2 return dropdown value, not id in view

New to ZF2. Pretty sure this is a very basic question as I can easily do it in procedural style, but finding the documentation difficult to work through. Any documentation links gladly received. I am storing a form dropdown value as an integer, in…
anewvision
  • 105
  • 2
  • 15
0
votes
1 answer

Zend 2 challenge :How to configure Zend Framework 2 to hold generic template outside a module?

I am new to ZF 2 and just trying to render generic layout outside a module's view directory. At the moment ,i have a module "categories" and in "Categories\view\generic\" ,i have splitted all common layout elements (i.e header(contains menus etc)…
0
votes
5 answers

Inject filter into Zend_View

I wish to set some properties in MyFilter with constructor injection but it seems impossible with Zend_View::addFilter(string $filter_class_name) since it loads a new instance upon usage. MyFilter implements Zend_Filter_Interface. Can I somehow…
chelmertz
  • 20,399
  • 5
  • 40
  • 46
0
votes
1 answer

Displaying image thumbnail after upload in zf2

I am working on a project in zend framework.I Have created a registration form in which I need to upload user image,which I am able to do so,but my question is how to display that uploaded image through view? Code: processAction() $request =…
prachi
  • 25
  • 1
  • 1
  • 9
0
votes
1 answer

Using Layouts setRoot() in standalone \Zend\View

What I need I needed a templating engine for a small site and I decided to try using \Zend\View. I'm not using Zend Framework itself though. So basically I want to do some data processing in my custom scripts outside of Zend, and then pass the…
0
votes
1 answer

ZF2: ViewHelper doesn't return value

I cannot find any solution nor even a question about this. I think its because it must be something completely obvious or this is an error nobody ever got. Cause, its not an error! Im not getting a error message, nothing in my logs, everything works…
Chilion
  • 4,380
  • 4
  • 33
  • 48
0
votes
2 answers

Availability of $this->var in Phalcon\Mvc\View\Simple

I'm responsible for a rather large web app I built 8 years ago, then later refactored using ZF1 and now trying to move beyond that into more modern framework components. At the moment am trying to see if I can swap out Zend_View for…
Chris442
  • 11
  • 2
0
votes
1 answer

Zend Framework Placeholder doesn't work when used in another action

Working with Zend Framework 1, I'm currently stucked with placeholders and really don't understand where is the issue. I would like to render some content using a placeholder in my main view :
placeholder( 'segment' ); ?>
I…
Alexandre Brach
  • 325
  • 2
  • 12
0
votes
1 answer

How to remove routing error in zf2?

I used authentication in zend module but when i render it gives me error like Zend\View\Renderer\PhpRenderer::render: Unable to render template "calendar/index/login"; resolver could not resolve to a files here is my module.config.php:
Muhammad Arif
  • 1,014
  • 3
  • 22
  • 56
0
votes
3 answers

Zend Framework: Using controller method in view to call model method

I've got a little problem here. I have category_id for every product in DB. I also have a category table in DB for categories and their ID. Now i need to put in into view together. I've made add, edit and delete action, also show action, where is…
Michal Takáč
  • 1,005
  • 3
  • 17
  • 37
0
votes
2 answers

Zend Framework 1 get param from route

I have a basic layout.phtml script that I use on every page. Now I would like to add an active class to the page loaded. So I would like to do like this: class=" if route ends with = ''? active : not-active " How can I do this in a ZF view? I need…
nielsv
  • 6,540
  • 35
  • 111
  • 215
0
votes
1 answer

Using actionHelper without returning layout in output

I call an action helper in one of my views using the following code echo $this->action('foo', 'bar'); The fooAction in the barController does its thing and outputs a list of pages. However, the list has the layout in the output again, which is…
Philip Bennison
  • 519
  • 2
  • 10
0
votes
2 answers

How to reencode url parameters with Zend Framework

I use the following code with my Zend Framework application: controller: $paramsOtherAction = $this->getRequest()->getParams(); $paramsOtherAction['action'] = 'otheraction' $this->view->paramsOtherAction = $paramsOtherAction; view:
Peter Smit
  • 27,696
  • 33
  • 111
  • 170
0
votes
1 answer

How to call static view helper method in controller?

like in topic, I have two static method in view helper but when I try to call in controller action by Zend_View_Helper_SomeHelper::firstStaticMethod(); I got error: Warning: include_once(Zend/View/Helper/SomeHelper.php): failed to open stream: No…
0
votes
1 answer

In ZF2 how to Escape HTML in Custom View Helpers

Here, I see someone suggesting to extend the Zend\View\Helper\Escaper\AbstractHelper;, resulting in something like this: namespace Photo\View\Helper; use Zend\View\Helper\Escaper\AbstractHelper; class Imghelper extends AbstractHelper { protected…
user2335065
  • 2,337
  • 3
  • 31
  • 54