I have a helper file which is similar to the codeigniter HTML file

But trying to make it so if I wanted to load style sheet or java script from controller I can do it my own way. Currenly Not Getting Links.

On Head View

Code:
<?php foreach ($links as $link) { ?>
<link href="<?php echo $link['href']; ?>" rel="<?php echo $link['rel']; ?>" />
<?php } ?>
Example would load
PHP Code:
 $this->document->addStyle('application/modules/backend/views/stylesheet/bootstrap.css'); 

Problem


PHP Code:
A PHP Error was encountered
Severity
Notice
Message
Undefined propertyCI::$document
Filename
MX/Controller.php
Line Number
58
Fatal error
Call to a member function addStyle() on a non-object in C:xampphtdocscodeigniter-cms-1adminapplicationmodulesbackendcontrollerscommonlogin.php on line 15 
Here is my helper file

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

class 
Document {

    private 
$links = array();
    private 
$styles = array();

    public function 
addLink($href$rel) {
        
$this->links[$href] = array(
            
'href' => $href,
            
'rel'  => $rel
        
);
    }

    public function 
getLinks() {
        return 
$this->links;
    }

    public function 
addStyle($href$rel 'stylesheet'$media 'screen') {
        
$this->styles[$href] = array(
            
'href'  => $href,
            
'rel'   => $rel,
            
'media' => $media
        
);
    }


}