Welcome Guest, Not a member yet? Register   Sign In
Library Not Found CI3
#1

I have placed my library in application / libraries / Document.php

And then when I go to autoload it. It Throws error


PHP Code:
Fatal error: Class 'CI_Document' not found in C:\Xampp\htdocs\project-1\system\core\Common.php on line 196
A PHP Error was encountered

Severity
Error

Message
: Class 'CI_Document' not found

Filename
core/Common.php

Line Number
196

Backtrace



Why is it throwing error when auto loading?

Document.php


PHP Code:
<?php

class Document {

    private 
$title;
    private 
$description;
    private 
$keywords;
    private 
$links = array();
    private 
$styles = array();
    private 
$scripts = array();

    public function 
setTitle($title) {
        
$this->title $title;
    }

    public function 
getTitle() {
        return 
$this->title;
    }

    public function 
setDescription($description) {
        
$this->description $description;
    }

    public function 
getDescription() {
        return 
$this->description;
    }

    public function 
setKeywords($keywords) {
        
$this->keywords $keywords;
    }

    public function 
getKeywords() {
        return 
$this->keywords;
    }

    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
        
);
    }

    public function 
getStyles() {
        return 
$this->styles;
    }

    public function 
addScript($script) {
        
$this->scripts[md5($script)] = $script;
    }

    public function 
getScripts() {
        return 
$this->scripts;
    }

There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply
#2

Are you autoload 'CI_Document' or 'Document'. Because you autoload 'CI_Document' but your library name is 'Document'
Reply
#3

Where is the Backtrace? Why didn't you post it?

Not really related to your question, but it would be good for you in the long future to respect the PHP style guide for the CodeIgniter framework: http://www.codeigniter.com/user_guide/ge...guide.html
Reply
#4

Do you have a 'Document' controller as well? This may be helpful: http://forum.codeigniter.com/thread-6238...#pid320496

(07-21-2015, 11:41 PM)Avenirer Wrote: Not really related to your question, but it would be good for you in the long future to respect the PHP style guide for the CodeIgniter framework: http://www.codeigniter.com/user_guide/ge...guide.html

The CI styleguide is only relevant to the framework's code. Of course, if you like it and you're using it, we'd be happy with that, but we don't promote it to people who just use CodeIgniter for something. It's good if you follow a styleguide at all, but it doesn't matter which one it is as long as you like it.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB