I'm trying to add some external information to a component, and it retrieves the data in view.html.php
. Once it is retrieved, how can I use it the model? I've tried as many of the usual variables that I can think of, but no success. I can see that it's buried down inside $this
(which is an extension of JModelAdmin
), but can find a way to get to it.
example\view.html.php
public function display($tpl = null) {
$this->state = $this->get('State');
$this->item = $this->get('Item');
$this->form = $this->get('Form');
$this->MyInfo = $this->get(MyInfo); // Use $this->item to get my info
models\example.php:
public function getItem($pk = null) {
if (!$item = parent::getItem($pk))
{
throw new Exception('Failed to load item');
}
return $item;
}
public function getMyInfo($pk = null)
{
// Need some of the data from `$this->item` already retrieved in function `display`
// Do some SQL here
return $mydata;
}