How to render ViewModel immediately (preventing future events)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to render ViewModel immediately (preventing future events)

dennis-fedco
Can I render View/ViewModel immediately?

There was a feature of ZF2 where one could avoid event triggering, or stop any future event triggering or view model rendering and return from that ViewModel() immediately, rendering something to the browser.

What was it?

I am using ViewModel code of ZF2 only and I am not using the entire Framework.  So I am looking for a ZF2 way to just render my ViewModel the moment I call it, as part of non-ZF2 application.
Reply | Threaded
Open this post in threaded view
|

Re: How to render ViewModel immediately (preventing future events)

Julian Vidal
Have you tried using the render() method on a
renderer<http://framework.zend.com/manual/2.0/en/modules/zend.view.renderer.php-renderer.html>
?

use Zend\View\Model\ViewModel;use Zend\View\Renderer\PhpRenderer;
$renderer = new PhpRenderer();
$model    = new ViewModel();$model->setVariable('foo', 'bar');
$model->setTemplate($templateName);$renderer->render($model);



On Tue, May 27, 2014 at 6:12 PM, dennis-fedco <[hidden email]>wrote:

> Can I render View/ViewModel immediately?
>
> There was a feature of ZF2 where one could avoid event triggering, or stop
> any future event triggering or view model rendering and return from that
> ViewModel() immediately, rendering something to the browser.
>
> What was it?
>
> I am using ViewModel code of ZF2 only and I am not using the entire
> Framework.  So I am looking for a ZF2 way to just render my ViewModel the
> moment I call it, as part of non-ZF2 application.
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/How-to-render-ViewModel-immediately-preventing-future-events-tp4662096.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: [hidden email]
> Info: http://framework.zend.com/archives
> Unsubscribe: [hidden email]
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: How to render ViewModel immediately (preventing future events)

dennis-fedco
Yes

by the way found what I was looking for here as well:  http://mateusztymek.pl/blog/using-standalone-zend-view

Thanks