Welcome Guest, Not a member yet? Register   Sign In
Functions in views ... how to organize them.

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?

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.

Theme © iAndrew 2016 - Forum software by © MyBB