Just a little explanation for a beginner... |
[eluser]knucklehead[/eluser]
Hello! I am getting started with CI, just as with MVC approach... So, please tell me if I understood the logic of all this correctly; Let's say I have a relational database full of artists and events for a club. I would like to get clean URLs at the end, something like last.fm style www.blah.com/artists/NAME www.blah.com/events/EVENTNAME etc. So, I should start with creating models for db queries, right? Let's call it artistsModel.php; Code: <?php Also, my results are now not 'grouped'. I wonder if I should do 'grouping' in my controller or my view? What I mean by that? If an artist has more than 1 link to their website i will get more than 1 row of that artist from db. So I should make each artist another 'object' with 'formatted' properties before I start to manipulate with him, right? I imagine my object would look like artist_name = string artist_description = string artist_links = array() artist_countries = array() ... And all my artists should look like that... So, should I create those objects in controller or view? If I make a controller like this: Code: class Artists extends Controller{ Should I make some programming to define an artist 'object' in controller and another programming in view to loop through my objects? I also wonder which datatype should be $data here? Should it be also an array of objects? Because right now, if i var_dump($data) I get an array with 1 value and it is called 'artists' which is actually an array of my rows... Is that ok? If I make some programming and create objects inside of controller, how should I 'pack' my results and send it to view? Uf, I am sorry for all the confusion and I know this is some extremely basic and beginner stuff, but I started with OOP few weeks ago and I am still a little bit confused about everything... Any suggestion/advice/help is extremely welcome! =) Thanks! |
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
|