Im working on a pre created joomla component which using the MVC Architecture, My problem like this:
In Models i have a .php file with database fetch function as
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.application.component.model' );
class class_name extends JModel
{
var $_data;
function getlast_year(){
$query = 'SELECT year FROM `table` ORDER BY year DESC LIMIT 0,1';
$this->_db->setQuery( $query );
return $this->_db->loadResult();
}
}
I added a new function to the same class file: (I have updated the table columns too in MVC /tables)
as:
function getAttendenceData()
{
$query="SELECT id,octSec,octNin,octSect,octSec,octTwent FROM `table`";
$this->_db->setQuery( $query );
//$this->_data = $this->_db->loadObjectList();
$this->_data = $this->_db->loadObject();
return $this->_db->loadObjectList();
}
but in view i cant still access the fetched data from the above new function but older functions are working property
This is not an actual answer but response to the comment.
First in your
view.html.phpfile, you’ll have to retrieve data from the model.$attendance_data = & $this->get('AttendenceData');This’ll give you the object list as you are returning from your getAttendenceData() function.
Now assign it to a view variable (lets say
data).$this->assignRef('data', $attendance_data);Now you can access this data in your view: