[eluser]LinkFox[/eluser]
[quote author="porangi" date="1305313728"]Hi,
I know this question has been asked many times before but I would just like some clarification. I am building a simple pages module that I can use in client sites. The idea is that its a simple CMS. I've created all the Frontend/Backend page stuff but what is the best approach with respect to the menu.
I know I could create a helper and call the DB etc from there but then I'm not really using the model and all the wonderful query functions etc I have created there which kind of breaks the MVC model does it not.
Maybe some will just tell me to chill and break the MVC but I want to ensure I doing it the 'right' way.
Cheers in advance.
Chris[/quote]
Hi I'm not really sure what you're asking but you can call models from helpers. You just need to get an instance of CI.
So
Code:
$inst = &get;_instance();
$inst->load->model('myModel');
$inst->mymodel->myfunction();
That way you can call your DB from your helper. Your helper should be called from your controller etc.
Theres nothing wrong with making database calls in a library or helper if you require information to make it work.
Hope this helps.
Regards
David