|
|||
|
When building applications with ZF I have recently stumbled upon situations where I need the same functionality both from views and actions controllers.
Not necessarily by the same action/view pair mind you. What I've done up until now is create one action helper and one view helper with exactly the same functionality. It doesn't take a fortune teller to see that this may quickly get out of hand, not to mention that it is a bad practice to have duplicate code lying around. So to my question then. What would be the best practice in this situation? What is your solution? The way I see it I could do one of two things: 1) Make the view helper inherit the action helper 2) Utilize the action helper in the controller and then pass the result to the view. There are cases when #2 wouldn't really be practical. So I'm guessing #1 is preferred but I'd still like to hear your thoughts on this. // Leif |
![]() |
| Thread Tools | |
| Display Modes | |
|
|