• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Split library into 2 versions, 'light' and 'complete', then call functions from either using just 1 library name.

#5
[eluser]tical[/eluser]
Thanks wh1tel1te, it worked exactly how I wanted.

For anyone else trying to do the same kind of thing, I then encountered another problem, that I've also since solved.

The 'Complete' version of the library needed to extend the 'Light' library, rather than duplicating the same functions from the light file in the complete file.

As of at least CI2.0, to extend a custom library use the following code:
This is in the 'Complete' library file, the 'Light' file is constructed as normal.
Code:
load_class('Light_library', 'libraries', FALSE);

class Complete_library extends Light_library
{
    public function __construct()
    {
        parent::__construct();
    }

    function your_other_functions()
    {
        ...
    }
}

Note: The 'load_class()' function is a CI system file and is liable to change in future CI versions. If anyone has a safer method of extending a custom library, please let me know.


Messages In This Thread
Split library into 2 versions, 'light' and 'complete', then call functions from either using just 1 library name. - by El Forum - 03-03-2011, 07:20 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.