Attempt 2 understand models and controllers |
[eluser]dnc[/eluser]
Yes, it needs to go in a controller or at the least a common functions file possibly in your include_path. Models are designed for database operations, per the guide What is a Model Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Quote:I have it In the view because it was easier to debug and get working. I don’t believe it belongs in the view but putting it inside a model doesn’t seem right either. and its not a controller. So it go in a controller I’m not sure. Just trying to get everything figured out the right way before I develop bad habits. By putting a function in a view file is a bad habit and goes against the MVC approach and the approach of most other php frameworks for that matter. |
Messages In This Thread |
Attempt 2 understand models and controllers - by El Forum - 05-21-2012, 12:07 PM
Attempt 2 understand models and controllers - by El Forum - 05-21-2012, 08:04 PM
Attempt 2 understand models and controllers - by El Forum - 05-22-2012, 12:55 AM
|