in my component Centros I have the view and model for Hospitals, working fine.
I want to call a general model. general.php
located in the models folder.
class CentrosModelGeneral extends JModelItem
{
protected $general;
public function getFck()
{
if (!isset($this->general))
{
$this->general = 'Hello World!';
}
return $this->general;
}
}
I want to access into the general model from my hospìtal component. So, inside my function display()
I am trying this:
$model = JModelLegacy::getInstance( 'general', 'CentrosModel');
var_dump ($model->get('fck'));
The var_dump
gives me a null
value. :(
What is wrong?. The var_duymp($model);
gives me a long StdClass.
object(CentrosModelGeneral)[360]
protected 'general' => null
protected '_item' => null
protected '_context' => string 'group.type' (length=10)
protected '__state_set' => null
protected '_db' =>
protected 'name' => string 'general' (length=7)
protected 'option' => string 'com_centros' (length=11)
protected 'state' =>
So, it looks like is working, but i dont know how to call the getFck function..
Any idea?