Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] call MODEL functions in the VIEW, really bad idea?
#7

[eluser]basementDUDE[/eluser]
[quote author="Maglok" date="1250095794"]You usually do not upgrade your CI version while developing an application, but when you start a new one.

Also I still don't see why you can't do what you are saying in the controller, cram it all in the $data array and use it in the view.[/quote]


ok, I need to list a product X. It has a PK key xid. In order to show the full product, 24 db tables has been created to store varies options.

Currently I use a foreach loop in the view to generate that table.

But here is the problem:
for example I need two field that shows how many images/video are linked to that product X.
I cannot do it. because I need to get the xid first then do a query to find out. Theoretically, I could combine whole bunch querys to a big one.
Call that function in controller and pass the result. However, it just too complex and risky for get it wrong.

Instead, I can just call some small model function in the view such as get_num_image(xid) for field1, get_num_video(xid) for field2 to get job done. Its not pretty, but I find out its much easier to work with.

Anyway, I guess that will be always a trade off in programming right?


Messages In This Thread
[SOLVED] call MODEL functions in the VIEW, really bad idea? - by El Forum - 08-12-2009, 03:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB