Welcome Guest, Not a member yet? Register   Sign In
Including class dependencies
#3

[eluser]TheFuzzy0ne[/eluser]
I understand that PHP 4 has problems with loading libraries/models in the constructor. Would it be breaking the whole MVC thing if put code outside of the class to check they are loaded, or load them if they aren't?

Code:
var $codeigniter =& get_instance();

if ( ! is_property($codeigniter, 'session')
{
    $codeigniter->load->library('session');
}

if ( ! is_property($codeigniter, 'user_model')
{
    $codeigniter->load->model('user_model');
}

class User
{
    # ...


Messages In This Thread
Including class dependencies - by El Forum - 05-14-2009, 10:05 AM
Including class dependencies - by El Forum - 05-14-2009, 12:03 PM
Including class dependencies - by El Forum - 05-14-2009, 12:13 PM
Including class dependencies - by El Forum - 05-14-2009, 01:04 PM
Including class dependencies - by El Forum - 05-14-2009, 01:30 PM
Including class dependencies - by El Forum - 05-14-2009, 01:38 PM
Including class dependencies - by El Forum - 05-14-2009, 01:53 PM
Including class dependencies - by El Forum - 05-14-2009, 02:07 PM
Including class dependencies - by El Forum - 05-14-2009, 03:05 PM
Including class dependencies - by El Forum - 05-14-2009, 03:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB