Welcome Guest, Not a member yet? Register   Sign In
Helper or Model for DB functions ?
#1

[eluser]ka-spot[/eluser]
I want to use functions like this:

Code:
function get_default_language()
{
    $CI =& get_instance();
    $CI->load->database();
    
    $CI->db->select('language')->from('languages')->where('default', 1);
    $get = $CI->db->get()->row();
    return $get->language;
}

inside different models like pages, products, categories, etc.
I'm learning CI while developing online store.


Currently i'm using helpers, but is it ok with the concept of MVC/CI?.

Wich one is better and why?
#2

[eluser]InsiteFX[/eluser]
If you are using the same methods over and over in different models then put them all in a helper!

Otherwise if they are just specific to that one model, then place them in that model.




Theme © iAndrew 2016 - Forum software by © MyBB