CodeIgniter Forums

Full Version: Why doesn't this library load in my controller?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Aquillyne[/eluser]
This is the file "stylesheet.php", which is in the subfolder "utilities" in my "controllers" folder.

Code:
<?php

class Stylesheet extends Controller
{

    function Stylesheet()
    {
        parent::Controller();
    }
    
    
    function foo()
    {
        $this->load->library("CSS");
        $this->CSS->select("body");
    }
    
}

?>

When I go to index.php/utilities/stylesheet/foo I get the error:

Quote:Fatal error: Undefined property: Stylesheet::$CSS. Call to a member function select() on a non-object in C:\Server\Frameworks\CodeIgniter\application\controllers\utilities\stylesheet.php

The "CSS" library is a custom library in my application's "libraries" folder. Its contents are:

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class CSS {

    function select($element)
    {

    }
    
}

?>

So as you can see, I am trying to load a custom library which contains the function "select" - but although I get no error message for the loading of the library, calling this select method just doesn't work!

Please help! Thanks.

El Forum

[eluser]arume[/eluser]
It's because you use upper case in the CSS library name. Call it css and it will be OK.