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

How do I send variables to an error layout in ZF3?

What is right way to send variables to the layout templete for it be approachable in error pages? I have AppFrontController above all my frontend controllers. It have code (code is near) in onDispatch() method: $assocArrayOfVars =…
2
votes
0 answers

zf3 view not finding helpers

I am having some trouble porting an site from zf2 to zf3. I have added a single module to the skeleton app and built it from there, but keep on getting the following exception when a custom view helper is called in my layout: Fatal error: Uncaught…
John Crest
  • 201
  • 1
  • 4
  • 24
2
votes
2 answers

How to setup multiple Layouts in Zend Framework. Eg. Public/Logged in/Various combinations of modules

I know & used the very basic Zend Framework's Layouts where I used 1 layout throughout the whole site. But now I need a more intermediate/organized setup. The public site layout will have the div#mainContent taking up the whole 12 columns (using…
Jiew Meng
  • 84,767
  • 185
  • 495
  • 805
2
votes
2 answers

Zend and Smarty 3 integration using

I am trying to change the layout content in my controller, which only seems to overwrite it, only append. I have built a CMS using Zend and Smarty. I have one main layout with, which displays the content for each…
John Magnolia
  • 16,769
  • 36
  • 159
  • 270
2
votes
2 answers

How to stop Zend Framework from appending '/scripts/' to the View Base Path

Thats basically my code (simplified): class IndexController extends Zend_Controller_Action { public function indexAction(){ $this->view->setBasePath(APPLICATION_PATH . '/views/partner/xyz/'); $this->view->render('node.phtml'); …
Hannes
  • 8,147
  • 4
  • 33
  • 51
2
votes
1 answer

Zend Framework: How to render a different action?

I have two actions that are essentially identical, but need different URLs. Normally I would use _forward() to render the other action: class MyController extends Zend_Controller_Action { public function actionOneAction() { …
Andrew
  • 227,796
  • 193
  • 515
  • 708
2
votes
1 answer

Why is this code full of slashes

I'm reading some RAW code from here http://www.zfsnippets.com/snippets/view/id/17/output/raw/table-view-helper where the author is doing a lot of slash escaping like this \'class\'. protected $_attribs = array( \'class\' => \'table\', …
silow
  • 4,256
  • 3
  • 21
  • 24
2
votes
2 answers

Zend controller/view newbie puzzle: $_GET & $_POST empty - on receipt from HTML form within view

Zend newbie here ... And just to make it better, my mission is to build on top of someone else's pre-existing Zend site. (BTW: zf show version --> Zend Framework Version: 1.11.1 -- I seem to have Zend_Form). Here's the curious bit. All the forms are…
confused
  • 31
  • 1
  • 4
2
votes
3 answers

Adding Zend View Helper to all views in application (in bootstrap)

I am using Zend Framework 1.6 hence I'm not utilizing Zend_Application. I have a simple, normal View Helper (extending Zend_View_Helper_Abstract). It works perfectly fine as long as I add it to the view in my action controller. But I want to be…
Ali
  • 603
  • 2
  • 6
  • 17
2
votes
3 answers

Zend Framework: Check if Zend View Placeholder isset

How can I check if a Zend View Placeholder isset before echo-ing it out? As I am wanting to prepend " - " to it before outputting it. I tried echo isset($this->placeholder('title')) ? ' - ' . $this->placeholder('title') : ''; But I got…
Jiew Meng
  • 84,767
  • 185
  • 495
  • 805
2
votes
2 answers

Zend Framework - Reusing view header information across Controller

In Zend Framework, I have a common use case where I need to propagate the same information in the top section of a view across a particular controller. For example, if I have a "Book" controller, I want to display the summary book information at the…
clarkstachio
  • 613
  • 4
  • 8
2
votes
4 answers

Zend_Form:: When should be form created in view and not in controller?

Zend_Form:: When should be form created in view and not in controller? option 1 - form created in controller and passed to view (usually used) controller: $form=new MyForm(); $this->view->form=$form; view: echo $this->form; option 2 - form created…
Ben
  • 25,389
  • 34
  • 109
  • 165
2
votes
5 answers

What's the best way to escape vars in Zend_View automatically?

A week or two ago I just started using Zend Framework seriously and have had trouble escaping manually with Zend_View::escape(). Does anyone knows how to escape vars in templates (Zend_View templates) automatically without using $this->escape(), or…
chikaram
  • 700
  • 1
  • 7
  • 18
2
votes
1 answer

Render a partial view with layout in Zend Framework 1.12

Similar questions have been asked before but unfortunately I am still not able to find a solution of my problem. I want to render a view with its layout and store its response into a variable. I have an action called pdf as shown below. public…
user5108430
2
votes
1 answer

Zend 2 define error page for controller

I have a module with several controllers. I want to use the normal error page for all controllers except for one. Is it possible to define a error page that is only used if an exception is thrown in a certain controller ? That is how the module…
Ephenodrom
  • 1,797
  • 2
  • 16
  • 28