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

How can I use Zend Layout with Zend View if I call the view from a model?

Basically, I want to render a view and layout from a model. Don't ask me why. First of all, the views work as intended and I'm loading them into a variable for my perverse use later on. I am also fully aware that I could always do partial scripts.…
John
  • 261
  • 1
  • 3
  • 16
0
votes
2 answers

Zend View array variable inside a partialLoop

Here is the code in my controller: $this->view->myArray = array(); $this->view->test = ""; $out = $this->view->partialLoop('tab/partial.phtml', $data); echo $this->view->test; // Output: This works echo count($this->view->myArray); // Output:…
Gil Birman
  • 35,242
  • 14
  • 75
  • 119
0
votes
2 answers

stylesheet view helper in zend framework

I wanted to append css stylesheet inside head tag but gets appended to body tag. Here's what i did: i have a controller 'countries' with action 'index' and my view is index.phtml index.phtml contains:
rockstar
  • 1,322
  • 1
  • 20
  • 37
0
votes
1 answer

Zend plugin to capture referrer for every visitor

To build some simple analytics for our site - I am trying to capture the source from where the user lands on our page and if he ends up registering - store the source in the database. Since this code has to be on all the pages - I thought of adding…
0
votes
2 answers

How to add custom view helpers to Zend Framework 2 (beta 4)

NOTE: This is an old question and the answers here no longer works (since beta5). See this question on how to do it with ZF2 stable version. I have looked at this example from the manual. Note that this is version 2 of the Zend Framework. I create…
Matsemann
  • 21,083
  • 19
  • 56
  • 89
0
votes
1 answer

Assign Zend View Helpers and Jquery to modules

I am unsure on how to propperly add a Zend View Helper to my Project. My project looks like this…
Björn
  • 203
  • 6
  • 19
0
votes
3 answers

Zend Menu extend

I'm working on a website with a "normal" menu and a submenu. This is the method in the bootstrap which is resonsible for the navigation: Bootstrap.php protected function _initNavigation() { $view = $this->getResource('view'); …
ivodvb
  • 1,164
  • 2
  • 12
  • 39
0
votes
2 answers

Pipe a Zend View into the Google Translate service?

I have seen all of the examples of using google translate with the zend framework, and I have the ability to translate strings of text with no problem. What I'm proposing is to build a "view helper?" that would take the rendered view and send the…
stagl
  • 501
  • 3
  • 18
0
votes
2 answers

set some view variable in controller constructer

I have the following code in my zf2 controller:
Sina Miandashti
  • 2,087
  • 1
  • 26
  • 40
0
votes
1 answer

How to return an Application_Model in JSON format in Zend Framework 1.11

I define a variable in my view, called Student. In my view, how to I display the Student object as a JSON? public function previewAction() { // ... $this->view->student = $student; } In my preview.phtml view, i have the…
zen.c
  • 678
  • 8
  • 17
0
votes
1 answer

Zend Framework - Change order of action output

I have two actions for image albums in my controller, the first creates a form to create a new album and handles the POST and the second generates a list of the existing albums. The form posts to the first action and then puts the list action on the…
Andreas S
  • 451
  • 5
  • 17
0
votes
2 answers

Zend framework : no other Action except index action in the controller is callable

I have a controller file with the two actions i.e : class IndexController extends Zend_Controller_Action { public function init() { /* Initialize action controller here */ } public function indexAction() { //…
0
votes
1 answer

setting defaults for zend_form_element (when using the view syntax)

I know I can create a form multi checkbox using new Zend_Form_Element_MultiCheckbox(). I'm not using this syntax however. I'm using the form view helper syntax in the view, like so: echo $this->formMultiCheckbox('boxes', null, null,…
sameold
  • 18,400
  • 21
  • 63
  • 87
0
votes
1 answer

sending data from action helper to partial view

i want to send some data from Action Helper to view Partial and i am unable to do it, to get the clear picture. here is all the related code i am using. in my layout.phtml i am using this placeholder. to generate onDemand navigation menu.
Ibrahim Azhar Armar
  • 25,288
  • 35
  • 131
  • 207
-1
votes
1 answer

Migrating ZF2 to ZF3: How to adapt navigation view?

In my ZF2 application I have a this navigation view script: $routeMatch = $this->getHelperPluginManager() ->getServiceLocator() ->get('Application') ->getMvcEvent() ->getRouteMatch(); $currentRoute = $routeMatch instanceof…
automatix
  • 14,018
  • 26
  • 105
  • 230
1 2 3
19
20