Note that there are some explanatory texts on larger screens.

plurals
  1. POcan I use model classe's methods in library methods codeigniter
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/12772083/php-notice-undefined-property">“PHP Notice: Undefined property”</a> </p> </blockquote> <p>I try to use external library in my CI web. I refer these links <a href="http://ellislab.com/codeigniter/user-guide/general/creating_libraries.html" rel="nofollow noreferrer">http://ellislab.com/codeigniter/user-guide/general/creating_libraries.html</a> and <a href="https://stackoverflow.com/questions/10656673/code-igniter-custom-library">Code Igniter custom library</a> to make this work but I get following error message</p> <pre><code>A PHP Error was encountered Severity: Notice Message: Undefined property: Dataloading::$load Filename: libraries/dataloading.php Line Number: 28 </code></pre> <p>What I try is load data for combo boxes from library. here is the code of library class</p> <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Dataloading { public function __construct() { } public function index() { } public function loadcombo(){ $this-&gt;load-&gt;model('dataOperateModel'); //Calling the getcombo_titel() function to get the arr of titles. Model already loaded. $arrStates = $this-&gt;dataOperateModel-&gt;getcombo_titel(); //Getting the final array in the form which I will be using for the form helper to create a dropdown. foreach ($arrStates as $job_name) { $arrFinal[] = $job_name-&gt;title; } $data['job_name'] = $arrFinal; $data['main_content']='home/welcome_message'; //Passing $data to the view, so that we can get the states as an array inside the view. $this-&gt;load-&gt;view('layout',$data); } } </code></pre> <p>Here is the code of welcome class</p> <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Welcome extends CI_Controller { public function __construct() { parent::__construct(); //this condition will check whether user has logged in, otherwise //he will be redirect to login if (!$this-&gt;session-&gt;userdata('logged_in')) { redirect('admin/admin_login'); } // $this-&gt;load-&gt;model('dataOperateModel'); } public function index() { //$this-&gt;load-&gt;view('welcome_message'); $this-&gt;load-&gt;library('dataloading'); $this-&gt;dataloading-&gt;loadcombo(); //$this-&gt;loadcombo(); } } </code></pre> <p>can anybody explain where I have done the mistake.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload