Welcome Guest, Not a member yet? Register   Sign In
News and statistics in the left column
#14

[eluser]sl3dg3hamm3r[/eluser]
I wouldn't mess around too much with globals. Stick to class-members, make data a member:

Code:
class SiteController extends Controller {
    var $_container;
    protected var $data;  // Not sure if 'protected' workes if PHP < 5, if not leave it away


    function SiteController() {
        // Call parent constructor
        parent::Controller();

        $this->data['news'] = $this->db->get('news');
        echo $this->data['news']->num_rows(); // This returns 2 as it should
    }
}

In the child class, you also need to write $this->data...

Not tested, but should work like that...


Messages In This Thread
News and statistics in the left column - by El Forum - 12-06-2008, 10:58 AM
News and statistics in the left column - by El Forum - 12-06-2008, 11:57 AM
News and statistics in the left column - by El Forum - 12-06-2008, 12:03 PM
News and statistics in the left column - by El Forum - 12-06-2008, 02:09 PM
News and statistics in the left column - by El Forum - 12-08-2008, 08:53 AM
News and statistics in the left column - by El Forum - 12-08-2008, 09:09 AM
News and statistics in the left column - by El Forum - 12-08-2008, 09:56 AM
News and statistics in the left column - by El Forum - 12-08-2008, 12:45 PM
News and statistics in the left column - by El Forum - 12-08-2008, 12:47 PM
News and statistics in the left column - by El Forum - 12-08-2008, 01:11 PM
News and statistics in the left column - by El Forum - 12-08-2008, 01:25 PM
News and statistics in the left column - by El Forum - 12-08-2008, 01:31 PM
News and statistics in the left column - by El Forum - 12-08-2008, 01:38 PM
News and statistics in the left column - by El Forum - 12-09-2008, 05:26 AM
News and statistics in the left column - by El Forum - 12-09-2008, 10:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB