8

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?

1
  • which version of CI are you using? and where have you saved Profilewall.php Commented Jan 23, 2011 at 21:14

4 Answers 4

31

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

Sign up to request clarification or add additional context in comments.

3 Comments

THANKS SO MUCH :D it was just profilewall then i load the library so only lowercase :D
Thanks so much! I never knew this, and had wasted a day. I'll rtfm more now. :)
Can we disable these Codeigniter naming conventions? Because I am from Java background and want to use Java naming conventions.
2

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

Comments

1

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

Comments

0

I had the same problem and after straggling alot I realized that I was loading my libraries in a wrong format. I was not putting them into an array. I changed $this->load->library('email','custom'); to $this->load->library(array('email','custom'));.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.