Welcome Guest, Not a member yet? Register   Sign In
How to call model function in view file?
#3

[eluser]mddd[/eluser]
noctrum is right.

I do want to point out that it is bad practice to go back and get stuff from the database when you are already in the view.
If you need more information about (for instance) the menu structure, you should load it before, and pass it to the view so the view can just display it.
It's best to keep the view as simple as possible and not do 'smart' stuff like database calls in there!!
Also, if you do it like you suggest, you'll make a database call for every item in the navlist! It is much more efficient to get all the relevant info in one database request and then pass that info to the view.


Messages In This Thread
How to call model function in view file? - by El Forum - 07-27-2010, 02:53 PM
How to call model function in view file? - by El Forum - 07-27-2010, 02:58 PM
How to call model function in view file? - by El Forum - 07-28-2010, 01:23 AM
How to call model function in view file? - by El Forum - 07-28-2010, 03:13 AM
How to call model function in view file? - by El Forum - 07-28-2010, 05:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB