Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

codeigniter cannot load library

I have a problem that I can't load my library in my controller :S

I got this error: Message: Undefined property: Profil::$profileWall

My library:

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

class ProfileWall
{

    private $CI;

    public function __construct()
    {
        $this->CI =& get_instance();
    }

    public function wallShow()
    {
        $this->CI->load->model('profil_model');
        return $this->CI->profil_model->wallGet($this->CI->uri->segment(3));
    }
}

and my controller

    function index()
    {
        $this->load->model('profil_model');
        $data['query'] = $this->profil_model->vis_profil($this->uri->segment(3)); 


        //Henter lib profilwall så man kan vise wall beskeder i profilen
        $this->load->library('profileWall');
        $data['queryWall'] = $this->profileWall->wallShow();



        $data['content'] = 'profil_view';
        $this->load->view('includes/template', $data);


}

What am I doing wrong?

like image 971
olla Avatar asked Jan 23 '11 20:01

olla


3 Answers

Make sure your library loading is always done in lowercase, per the Documentation, object instances will always be lower case.

Also make sure your library file is capitalized ProfileWall.php

example load $this->load->library('profilewall');

usage $this->profilewall->function();

like image 141
jondavidjohn Avatar answered Nov 05 '22 04:11

jondavidjohn


Library in code igniter didn't concentrate for lower case, Have you placed your library in folder application/library? before or try changed your class name with CI_ProfileWall

like image 21
Angripa Avatar answered Nov 05 '22 05:11

Angripa


I have been saved my files with CKEditor CKFinder in /libraries folder. I changed with first letter of CKFinder to Ckfinder and CKEditor to Ckeditor. Working fine.

In your profileWall , it should be Profilewall

like image 44
Avinash Raut Avatar answered Nov 05 '22 05:11

Avinash Raut