Sto creando un plugin per Wordpress, ma credo sia un errore del php.
Non riesco ad accedere ad alcune funzioni di altre class e ricevo tale errore:
Fatal error: Uncaught Error: Call to undefined method Loader::get_utente()
file controller
Codice PHP:
class Controller{
public $load; public $model;
function __construct() {
global $wpdb;
include_once(plugin_dir_path(dirname(__FILE__)).'loaders/loaders.php');
include_once(plugin_dir_path(dirname(__FILE__)).'models/models_m.php');
$this->$model = new Model_M(); $this->$load = new Loader();}
public function index(){ $dati=$this->show();...... }
public function show(){ $this->$model->get_utente();.....}
file model
Codice PHP:
class Model_M{
function __construct() {}
function get_utente(){
$sql='SELECT p.* FROM tblprova p ORDER BY utente'; $result=$GLOBALS['wpdb']->get_results($sql,OBJECT_K); return $result; }
}