How to create view helper zend 2

Share/Bookmark

in tutorial zend framework 2 now i will share how to create view helper in zend 2, since i am forgetful person :P so i decided to write in my blog. ” view helper ” as you can see by its name this is a class that you can call or access it in your view file ” file.phtml “. so when you need a class in your view file like a function to calculate total or anything else. you need to create “view helper” it’s difference with “action helper ” because “Action helper” is intended to just call from action controller.

1. create a new directory nad new file

 

2. add new file in it :

 

3. Edit your Module.php

 

4.How to use it in your view file :

 

Tags : tutorial zend 2 tutorial zend framework 2 view helper zend 2

One Response to “How to create view helper zend 2”

  1. […] time i wrote about tutorial how to create view helper in zend framework 2. now i am going to share how to use model table gateway in view helper. i will use the code in last […]

Leave a Reply