• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Functions in views ... how to organize them.

#1
[eluser]behdesign[/eluser]
In my current project, I'm trying to keep php in views to a minimum, so I'm delegating rendering things like lists to functions in the library that's assembling all the different views to one page (header view, content view, etc). The problem is this: there are going to be a LOT of these helper functions as I'm going along - 2-3 per page. Instead of cluttering up the one library, I wanted to organize them in another way. My question is: what funcions are available in a view? I thought about using a helper (or more than one), but that means calling get_instance() in every helper function that needs access to model data. What other functions are available to views, or is there a different way that I could organize these sorts of view functions?

#2
[eluser]danmontgomery[/eluser]
Helpers are the best way... As long as a helper is loaded anywhere before the view is called, you don't need to call get_instance() in the view... Those functions are now globally accessible.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.