Welcome Guest, Not a member yet? Register   Sign In
Accessing classes
#5

[eluser]zippy[/eluser]
I'm with dpgtfc on this. Shared functionality ought to be extracted to a helper function (simple case) or a library class (complex case).

What's often overlooked is the fact that a controller can hand-off (i.e., delegate) to a library class by passing its own instance ($this) to the library's constructor, or to some method of the library class.

With the controller instance in hand, the library (or its method) has unfettered access to all of the properties and methods of the controller; it is, after all, acting as delegate to the controller.

This is very powerful. It can help remove any amount of redundant code from your controller(s).


Messages In This Thread
Accessing classes - by El Forum - 12-06-2008, 07:11 AM
Accessing classes - by El Forum - 12-06-2008, 09:05 AM
Accessing classes - by El Forum - 12-06-2008, 09:29 AM
Accessing classes - by El Forum - 12-06-2008, 11:49 AM
Accessing classes - by El Forum - 12-06-2008, 01:12 PM
Accessing classes - by El Forum - 12-06-2008, 04:33 PM
Accessing classes - by El Forum - 12-06-2008, 04:37 PM
Accessing classes - by El Forum - 12-06-2008, 05:08 PM
Accessing classes - by El Forum - 12-06-2008, 05:29 PM
Accessing classes - by El Forum - 12-06-2008, 05:31 PM
Accessing classes - by El Forum - 12-06-2008, 05:35 PM
Accessing classes - by El Forum - 12-06-2008, 05:40 PM
Accessing classes - by El Forum - 12-06-2008, 05:42 PM
Accessing classes - by El Forum - 12-06-2008, 05:51 PM
Accessing classes - by El Forum - 12-06-2008, 11:19 PM
Accessing classes - by El Forum - 12-07-2008, 04:49 PM
Accessing classes - by El Forum - 12-08-2008, 04:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB