advice about models - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: advice about models (/showthread.php?tid=10523) |
advice about models - El Forum - 08-03-2008 [eluser]Unknown[/eluser] I'm still try to understand how best to use CI's models and I'm looking for some advice: Lets say I have a blog posts and each of those has comments. I want to be able to get the last 10 blog posts which I would understand I could do in a model like this (from the docs) Code: class Blogmodel extends Model { What i would like to do is be able to use the Blogmodel as and object to do something like Code: foreach ($last_ten_blogs as $blog) and to use the "models" as stand alone objects. Does that work? Am I approaching it the right way? I was able to accomplish this uses "libraries" and I would just do this: Code: $this-load->library('Myfoo'); But I wasn't sure if that was really the right way to approach this - or if I could/should use models instead? |