Welcome Guest, Not a member yet? Register   Sign In
Better practice to do this?
#3

[eluser]Lockzi[/eluser]
Solved!

For everyone else who might be in need of doing something like this, here's what I finally found out!

Controller
Code:
foreach ($this->doForum['rawTopics']->result() as $topic) {
            
            $this->forum['topics'][$topic->id] = $topic;

            $this->forum['topics'][$topic->id]->last_post_by_username    = $this->user->id_to_loginname($topic->last_post_by)->row()->user_screenname;
            $this->forum['topics'][$topic->id]->started_by_username        = $this->user->id_to_loginname($topic->started_by)->row()->user_screenname;
        }

Basically what you need to do is to save it as a new object array (once you get ->result() you can't edit it anymore) and then add [$topic->id] to the object array to get it listed and finally (if you want to) you do ->whatever. that "->whatever" means what you want to use when to call that value.
Sorry if my descriptions on how to do this is a little lame, but I think the code speaks for itself Smile

EDIT: removed some debugging die(print_r()); rows from the code to make it cleaner

Best regards,
Lockzi


Messages In This Thread
Better practice to do this? - by El Forum - 10-27-2007, 08:32 AM
Better practice to do this? - by El Forum - 10-27-2007, 04:46 PM
Better practice to do this? - by El Forum - 10-27-2007, 07:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB