I have very little knowledge about joomla core and PHP. In order to better handle my website, I am trying to read a small part of joomla core, when I come across this function JTable:getInstance
, (libararies\joomla\table\table.php line268), it returns
return new $tableClass($db);
To understand what getInstance
returns, I need to know how this $tableClass
is defined, so I searched it in all php files in my website, although there are lots of references, even some so-called 'definitions' as this page points out, none of them is what I am looking for. I am expecting something like
class tableClass{...}
Furthermore, from other php files, there are these lines:
$row = JTable::getInstance('K2Item', 'Table');
$row->hit($id);
So it looks to me, what is returned by getInstance
should be an object that has a member hit()
, so I am expecting something like
class tableClass{...
function hit(){
.....
}
}
But this kind of code is nowhere to be found, so I am stuck here and definitely need help.
Some of my thoughts: Is $tableClass really a class? I notice that it has a $
, which all other classes don't have? If it is not a class, then why it could be invoked like this new $tableClass
? I really need to understand these basics but it is kind of hard to google keyword $
.