Welcome Guest, Not a member yet? Register   Sign In
Calling the database from a view file?
#2

[eluser]TheFuzzy0ne[/eluser]
CodeIgniter doesn't force you not to use models in your views, however, I do believe calling the upon the database directly from inside a view goes against the whole "MVC" thing. Generally, it's the controller that's the link between the model/database and the view. It gets it's information from models or user input and then sets the variables for the view before loading it. I would recommend that you export that function to a model. It's the logical place to put it, and may save you some head scratching 6 months from now when you want to develop your application further.

Hope this helps.


Messages In This Thread
Calling the database from a view file? - by El Forum - 02-08-2009, 11:42 AM
Calling the database from a view file? - by El Forum - 02-08-2009, 12:04 PM
Calling the database from a view file? - by El Forum - 02-08-2009, 01:18 PM
Calling the database from a view file? - by El Forum - 02-08-2009, 01:54 PM
Calling the database from a view file? - by El Forum - 02-08-2009, 02:16 PM
Calling the database from a view file? - by El Forum - 02-08-2009, 02:49 PM
Calling the database from a view file? - by El Forum - 02-08-2009, 02:54 PM
Calling the database from a view file? - by El Forum - 02-10-2009, 12:36 AM
Calling the database from a view file? - by El Forum - 02-11-2009, 08:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB