1

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?

4
  • you only have to declare gionda_date in declaration class in controllers/Cpages.php . Commented Dec 11, 2016 at 10:44
  • Try using add $this->load->library('gionda_date'); or in the __construct area of controller Commented Dec 11, 2016 at 20:08
  • you can also load libraries directly in your constructor like: require_once(APPPATH.'libraries/librarystartpage.php'); Commented Dec 11, 2016 at 21:38
  • Also the file name for libraries first letter uppercase only libraries/Gionda_date.php Commented Dec 12, 2016 at 2:50

1 Answer 1

1

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')
Sign up to request clarification or add additional context in comments.

1 Comment

I find an answer to this post. Thanks all.

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.