News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rob Allen:
Configuring a ZF2 view helper before rendering
July 31, 2013 @ 09:57:52

Rob Allen has a quick new post with details about configuring a view helper for a Zend Framework 2 application prior to its results being rendered.

When I was reading the documentation for the currencyFormat view helper, I discovered that you could configure the currency code and locale once rather than in every call. [...] This is obviously useful, but even more useful would be if we could set it once by default and then override if we need to in a specific call. The easiest way to do this is to use an event listener on the renderer.post View event within a modules's onBootstrap method.

He includes code to illustrate the process, configuring the renderer in the bootstrap of the application to use the GBP currency code and the "en_GB" locale for formatting its output. You can find out more about what the currencyFormatter can do in Rob's previous post.

0 comments voice your opinion now!
view helper zendframework2 configuration bootstrap

Link: http://akrabat.com/zend-framework-2/configuring-a-zf2-view-helper-before-rendering

blog comments powered by Disqus

Similar Posts

Master Zend Framework: How to Use ZFTool Diagnostics To Ensure Your Modules Work

MaltBlue.com: \Zend\Db\Sql - Creating Joins and Unions with Ease

Kevin Schroeder's Blog: ZF2 Dependency Injection: Managing Configuration - Part 1

Ryan Malesevich's Blog: WP Plugins: WP-Chunk

MaltBlue.com: Use Zend Framework Modules and Save Development Time


Community Events

Don't see your event here?
Let us know!


opinion version series voicesoftheelephpant laravel extension example framework unittest podcast introduction interview release php7 library conference language laravel5 community api

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework