Welcome Guest, Not a member yet? Register   Sign In
Creating and using libraries
#11

[eluser]Colin Williams[/eluser]
__autoload() is PHP 5 only, and CI aims to be PHP 4 compatible.

CI also has a load_class() method that works like including. It expects the class follows the conventions of a library, and you can pass a second argument of TRUE or FALSE depending on whether or not you want to instantiate the class.

Code:
public function  __construct() {
        $barra = array();
        load_class('Menu', FALSE);
        $barra[] = new Menu('Início', 'inicio', false);
        $barra[] = new Menu('Automóveis', 'automoveis', false);
        $barra[] = new Menu('Eventos', 'eventos', false);
        ....


Messages In This Thread
Creating and using libraries - by El Forum - 09-30-2009, 04:09 PM
Creating and using libraries - by El Forum - 10-01-2009, 07:11 AM
Creating and using libraries - by El Forum - 10-01-2009, 08:44 AM
Creating and using libraries - by El Forum - 10-01-2009, 02:13 PM
Creating and using libraries - by El Forum - 10-01-2009, 02:38 PM
Creating and using libraries - by El Forum - 10-01-2009, 02:49 PM
Creating and using libraries - by El Forum - 10-01-2009, 02:58 PM
Creating and using libraries - by El Forum - 10-01-2009, 03:04 PM
Creating and using libraries - by El Forum - 10-01-2009, 03:47 PM
Creating and using libraries - by El Forum - 10-01-2009, 04:03 PM
Creating and using libraries - by El Forum - 10-01-2009, 05:29 PM
Creating and using libraries - by El Forum - 10-01-2009, 08:02 PM
Creating and using libraries - by El Forum - 10-01-2009, 08:22 PM
Creating and using libraries - by El Forum - 10-06-2009, 12:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB