Welcome Guest, Not a member yet? Register   Sign In
How to pass variables from a model to another model?
#5

[eluser]Althalos[/eluser]
I had some errors in my code, if you still feel like giving it a try. First and foremost, the following line:
$sections = $this->db->select('name')->where('lang', $lang)->get('cms_section');

Should be:
$sections = $this->db->select('name')->where('lang', $lang)->get('cms_section')->result_array();

It is very important to return the query-data as an array, since I am assuming it to be an array in my foreach. I create a new key in this result array, into which I put relevant data which belongs to that section.

But if you don't feel you have the time to do it, it doesn't matter. Your code works and as long as the application is not going to huge and worked on by several people, adhering to the MVC principles is not the most important thing in the world.


Messages In This Thread
How to pass variables from a model to another model? - by El Forum - 07-17-2010, 11:55 AM
How to pass variables from a model to another model? - by El Forum - 07-17-2010, 06:34 PM
How to pass variables from a model to another model? - by El Forum - 07-17-2010, 07:21 PM
How to pass variables from a model to another model? - by El Forum - 07-18-2010, 12:41 PM
How to pass variables from a model to another model? - by El Forum - 07-18-2010, 01:49 PM
How to pass variables from a model to another model? - by El Forum - 07-19-2010, 06:24 AM
How to pass variables from a model to another model? - by El Forum - 07-19-2010, 08:01 AM
How to pass variables from a model to another model? - by El Forum - 07-19-2010, 08:17 AM
How to pass variables from a model to another model? - by El Forum - 07-19-2010, 03:00 PM
How to pass variables from a model to another model? - by El Forum - 07-20-2010, 09:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB