Welcome Guest, Not a member yet? Register   Sign In
Efficiently re-using code
#2

[eluser]OwanH[/eluser]
Hey Xandrios,

You can try this:

Place the header, menu, side and footer code within their own views and simply embed those views within the individual page views. Then let your controllers query all the data from the db and pass it to the page views. The individual page views can pass that data on to the embedded views as well.

Now to avoid having repetitive code in your controllers I think it would be good idea to develop a library of classes that provide functions for extracting data from the db for these common views, including the sidebar poll-view. You would then load these libraries in your page controllers and call the class methods to get the data for the common page views.

Hope this helps.


Messages In This Thread
Efficiently re-using code - by El Forum - 07-06-2007, 01:45 PM
Efficiently re-using code - by El Forum - 07-06-2007, 02:34 PM
Efficiently re-using code - by El Forum - 07-06-2007, 03:08 PM
Efficiently re-using code - by El Forum - 07-06-2007, 07:12 PM
Efficiently re-using code - by El Forum - 07-06-2007, 07:25 PM
Efficiently re-using code - by El Forum - 07-07-2007, 05:50 AM
Efficiently re-using code - by El Forum - 07-07-2007, 06:23 PM
Efficiently re-using code - by El Forum - 07-08-2007, 10:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB