Using modules as a widget
Widgetizing is a great method to use modules on different places in our applications. That's why this recipe will explain everything we need to know about doing this in the best way possible.
Getting ready
A working Zend Framework 2 skeleton application is needed to make full use of this recipe.
How to do it…
Widgets, they even sound great! We will explain in this recipe what they do and how they can be used.
Creating the Comment/Controller/Index
We will create a small controller that will return some example comments, which are static and hardcoded for example only. First we should make sure we have a Comment
module, so we create the following directories and files:
module/ Comment/ config/ module.config.php src/ Comment/ Controller/ IndexController.php view/ comment/ index/ index.phtml Module.php
Once we have the structure in place, we put the simplest code in the...