Welcome Guest, Not a member yet? Register   Sign In
Just a little explanation for a beginner...
#4

[eluser]knucklehead[/eluser]
Hi and thanks for quick replies and warm welcoming =)

I am used to write with camel case, but yes, I have noticed those underscores all around source code and I will listen to your advice and switch, before I actually start with everything!

Grouping in model - ok, I can make what you said - group it in model or make some private/public methods. I hope you understand that this is not mysql query grouping, this is actual formatting of my artist object, right... =)
But ok, let me see if I understood you correctly;
in my model:
Code:
function get_all_artists(){

        $query = "..."; // some query to get all artists
        
        $data = $this->db->query($query);
        $a = array(); // this is the 'handler' for each artist
        foreach ($data->result() as $artist){
             // something like
             $a[$artist->artistID]['artistName'] = $artist->artistName;
             $a[$artist->artistID]['links'][$artist->artistLinkURL] = $artist->artistLinkURL;
             // etc.
        }
        return $a;
        
}

...then my controller stays the same as above example (but without properties) and my view gets an $artists array which I format to some HTML. My $artists ends up like an array full of artist arrays, not objects...

Would that be the correct logic?


Messages In This Thread
Just a little explanation for a beginner... - by El Forum - 09-25-2009, 06:52 AM
Just a little explanation for a beginner... - by El Forum - 09-25-2009, 06:59 AM
Just a little explanation for a beginner... - by El Forum - 09-25-2009, 07:21 AM
Just a little explanation for a beginner... - by El Forum - 09-25-2009, 07:46 AM
Just a little explanation for a beginner... - by El Forum - 09-25-2009, 09:07 AM
Just a little explanation for a beginner... - by El Forum - 09-25-2009, 09:27 AM
Just a little explanation for a beginner... - by El Forum - 09-25-2009, 10:27 AM
Just a little explanation for a beginner... - by El Forum - 09-25-2009, 11:04 AM
Just a little explanation for a beginner... - by El Forum - 09-26-2009, 12:20 AM
Just a little explanation for a beginner... - by El Forum - 10-07-2009, 04:08 PM
Just a little explanation for a beginner... - by El Forum - 10-07-2009, 04:44 PM
Just a little explanation for a beginner... - by El Forum - 10-07-2009, 05:07 PM
Just a little explanation for a beginner... - by El Forum - 10-07-2009, 05:14 PM
Just a little explanation for a beginner... - by El Forum - 10-07-2009, 05:24 PM
Just a little explanation for a beginner... - by El Forum - 10-08-2009, 05:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB