Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-22-2008, 11:39 AM
Member
 
Join Date: Aug 2007
Location: Sweden
Posts: 52
Send a message via MSN to Leif.Högberg
Default When action/view helpers are doing the same thing...

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:13 PM.