Welcome Guest, Not a member yet? Register   Sign In
Code logic in codeigniter
#6

(This post was last modified: 08-25-2015, 03:38 PM by cartalot.)

plus one to what mwhitney said.
also in your controller take a look at this line

Code:
$user = $this->users->select_details_by_id($user_id);

and then a bunch of stuff that depends on $user coming back.
the problem is -- what happens if the $user_id is invalid or nothing comes back?
you might need a fallback view to show if it fails, or you could make them an anonymous user.

another suggestion, all the code creating user->link, the picture etc - is in your controller. 
thats some of the first things to get refactored into models. so try and remove logic from views, 
and refactor view specific code from the controller into models. Then as you refactor your controllers become "thinner", 
and your views are mostly html and css. 
Reply


Messages In This Thread
Code logic in codeigniter - by sebastianvirlan - 08-24-2015, 01:54 PM
RE: Code logic in codeigniter - by mwhitney - 08-25-2015, 08:55 AM
RE: Code logic in codeigniter - by cartalot - 08-25-2015, 11:38 AM
RE: Code logic in codeigniter - by mwhitney - 08-25-2015, 01:41 PM
RE: Code logic in codeigniter - by cartalot - 08-25-2015, 03:34 PM
RE: Code logic in codeigniter - by mwhitney - 08-26-2015, 08:22 AM
RE: Code logic in codeigniter - by cartalot - 08-25-2015, 08:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB