D YG
D YG

Reputation: 27

Adding new library

http://127.0.0.1/masterlinkci2/admin/cpages/pages

I get this error message:

A PHP Error was encountered

Severity: Notice

Message: Undefined property: Cpages::$gionda_date

Filename: controllers/Cpages.php

Line Number: 200

Line 200: $data['gionda_date'] = $this->gionda_date->g_date();

controllers/Cpages.php

public function pages() { 

    $data['pagessuccess'] = ''; 

    $data['pages'] = $this->Mpages->call_pages();

    $data['gionda_date'] = $this->gionda_date->g_date();

    $this->load->view('pages', $data); 

}

libraries/gionda_date.php

class Gionda_date {

private $CI;

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

public function g_date()
{
    $datestring = 'Year: %Y Month: %m Day: %d - %h:%i %a';
    return $datestring;
}

Can anyone help me fix the error messages?

Upvotes: 1

Views: 40

Answers (1)

qwertzman
qwertzman

Reputation: 782

Is you library loaded in your Cpages controller?

$this->gionda_date->g_date();

edited because of comment here is the most likely solution:

$this->load->library('gionda_date')

Upvotes: 1

Related Questions