xoops forums


Module Developer
Posted on: 2010/5/18 13:23
zyspec (Show more)
Module Developer
Posts: 1077
Since: 2004/9/21

Re: Object getByLink usage - setting table_link variable

Okay... Here's a sample of some code that does the table join as expected.
$object_id 3// whatever value for id you want to count

$class_handler =& xoops_getmodulehandler('<classname>'$xoopsModule->getVar('dirname'));
$class_handler->table_link $xoopsDB->prefix('<linked_table_name>');
$class_handler->field_link '<linked_table_column_name>';
$class_handler->field_object '<this_class_object_column_name>';
$criteria = new Criteria('o.<column_name_from_object>'$object_id'=');
$result  $class_handler->getCountByLink($criteria);

Hope this helps... Thanks BÁNÐÍT-X for pointing me in the right direction.