zend-view

How to capture a Zend view output instead of actually outputting it

廉价感情. 提交于 2019-12-07 02:44:30
问题 Problem: sometimes in our zend controller we don't want the script to be output directly, but rather want the content of that script. One example: when we need the result html output of a view script be included in another structure like JSON or XML for processing in the client side. I found the result here at stack overflow, but not so quick since it was in a different context. I have been struggling with this for 2 days now. As it turned out it was very simple: // in our controllers' action

Using PhpRenderer directly with child views in ZF2

让人想犯罪 __ 提交于 2019-12-06 14:13:56
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. Exactly how layouts work in general. To accomplish this, I am trying to add a child view model to my layout view model and render it with the PhpRenderer . public function someMethod() { $child = new ViewModel(); $child->setTemplate('test-template'); $layout = new ViewModel(); $layout->setTemplate('email-layout'); $layout->addChild($child, 'content');

Modify Stack in the Zend HeadScript View Helper

核能气质少年 提交于 2019-12-06 10:16:47
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 this and some of the other view helpers makes this statement: HeadScript overrides each of append(), offsetSet(), prepend(), and set() to enforce usage of the special methods as listed above. Internally, it stores each item as a stdClass token, which it later serializes using the itemToString() method. This allows you to perform checks on the items

Autocompletion for ZF2 view helpers in PhpStorm

落花浮王杯 提交于 2019-12-06 02:32:21
问题 Does anyone know if PHPStorm has some builtin support for view helper autocompletion or a possibility to write a plugin for it. I don't want to use inline var definitions for this as this would be cumbersome to do if I use a lot of view helpers $this->inlineScript()-> //I want some autocomplete here. $this->translate('some translation')-> //Please give me autocompletion If I use var definitions it will end up as something like this, but it will really clutter up my view: /* @var $inlineScript

Zend_View_Helper vs Zend View Partial Script

僤鯓⒐⒋嵵緔 提交于 2019-12-06 00:20:25
问题 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 all the buttons to be the same except for maybe the size that they are. Now, should I use a partial script with the html for the button and call the partial view helper to render or should I create a Zend_View_Helper that will return the html for

How to capture a Zend view output instead of actually outputting it

不羁的心 提交于 2019-12-05 09:45:02
Problem: sometimes in our zend controller we don't want the script to be output directly, but rather want the content of that script. One example: when we need the result html output of a view script be included in another structure like JSON or XML for processing in the client side. I found the result here at stack overflow, but not so quick since it was in a different context. I have been struggling with this for 2 days now. As it turned out it was very simple: // in our controllers' action method $this->_helper->layout()->setLayout('empty'); // disable layout $this->_helper->viewRenderer-

Zend Framework 2 - How to include partial from library

元气小坏坏 提交于 2019-12-04 21:35:47
问题 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 $this->partial('/../../../../vendor/myvendor/library/MyVendor/View/Views/FormPartial.phtml' , array(...)); Any ideas how to link to my vendor directory from my view? 回答1: The problem is the resolver can't resolve the path of the view template you had provided.

Override Separator on Zend_Form Radio Elements When Using a ViewScript Decorator

余生颓废 提交于 2019-12-04 19:39:30
I am using ViewScripts to decorate my form elements. With radio elements, the separator can normally be overridden, but the override is being ignored when I use the ViewScript. When I use the below call and ViewScript, the radio elements are separated by a '<br />' rather than the space I've specified. If leave the default decorators, the override works. $this->addElement('radio', 'active', array( 'disableLoadDefaultDecorators' => true, 'decorators' => array(array('ViewScript', array('viewScript' => 'form/multi.phtml'))), 'label' => 'Active', 'required' => true, 'multiOptions' => array('1' =>

How to get code completion for variables into zend_view using netbeans 6.9.1?

北战南征 提交于 2019-12-04 18:10:42
i'm evaluating to switch to netbeans ide for managing my zend_framework project; i'd like to have autocompletion for variable's name into my view, for variables defined in actions as i see in this screencast, http://netbeans.org/kb/docs/php/zend-framework-screencast.html , but i can't figure out. When i digit $this-> in any view i can't see none variable's name. I'd like a lot to use this feature. Thank you, Mirco. You need to have Zend Framework either in the include path for the project within Netbeans or within the project itself. You can then use cmd+space after a "->" to autocomplete an

Zend Framework - Set No Layout for Controller

荒凉一梦 提交于 2019-12-04 18:03:13
问题 I have a Controller that I want to use for ajax scripts to call and set session variables, get information, etc. How do I set it so that that particular controller doesn't use the default layout (specifically NO layout) so that it can send XML/JSON messages back and forth? 回答1: Like anything to do with Zend_Framework and Zend_Application, there are multiple ways to do this, but on the last few pure Zend gigs I've done, I've seen people using the following (from an action method in you