CodeIgniter Forums
Trouble with 'library' object - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Trouble with 'library' object (/showthread.php?tid=25393)



Trouble with 'library' object - El Forum - 12-10-2009

[eluser]Unknown[/eluser]
I've created a 'library' object named CssLoader and saved it in /system/application/libraries as "CssLoader.php" Anyone see what's wrong with the code below?

CssLoader.php code follows:
Code:
<?php
    class CssLoader {
        function __construct($cssFiles) {
                if ($cssFiles != NULL)    return $testing = array('Testing', '1', '2', '3');
        }
    }
?>

The controller code is:
Code:
<?php
    class Home extends Controller {
    
        public function __construct() {
            parent::Controller();
        }
        
        public function index() {
            $args = array('layout');
        $content = array();        
            $content['linkedList'] = $this->load->library('CssLoader', $args);
            $content['title'] = 'Welcome';
            $content['body'] = $this->load->view('home', '', true);
            $this->load->view('template', $content);
        }
    }
?>



Trouble with 'library' object - El Forum - 12-10-2009

[eluser]Colin Williams[/eluser]
When creating library classes, only the first letter of the class name should be capitalized.