1
At the moment I try to add functionalities from the Tag module to XoopsTube.
I've added these lines to admin/index.php which cause the keywords to be added to the Tag module tables:
// Add keywords to Tag-module
if (xtube_tag_module_included()) {
include_once XOOPS_ROOT_PATH."/modules/tag/include/formtag.php";
$tag_handler = xoops_getmodulehandler('tag', 'tag');
$tag_handler -> updateByItem($_POST['keywords'], $lid, $xoopsModule -> getVar('dirname'), $catid =0);
}
The keywords cq. tags appear in the Tag Cloud block.
When I click on a tag in this block I get the following error:
Error: Handler does not exist
Module: xoopstube
Name: xoopstube in file /include/functions.php line 551
In the folder include I've created the file plugin.tag.php :
/**
* Tag info
*
* @copyright The XOOPS project https://xoops.org/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
* @author Taiwen Jiang (phppp or D.J.)
* @since 1.00
* @version $Id$
* @package module::tag
*/
if (!defined("XOOPS_ROOT_PATH")) {
die("XOOPS root path not defined");
}
/**
* Get item fields:
* title
* content
* time
* link
* uid
* uname
* tags
*
* @var array $items associative array of items: [modid][catid][itemid]
*
* @return boolean
*
*/
function xoopstube_tag_iteminfo(&$items)
{
$items_id = array();
foreach(array_keys($items) as $cat_id){
// Some handling here to build the link upon catid
// if catid is not used, just skip it
foreach(array_keys($items[$cat_id]) as $item_id){
// In article, the item_id is "art_id"
$items_id[] = intval($item_id);
}
}
$item_handler =& xoops_getModuleHandler("xoopstube","xoopstube");
$items_obj = $item_handler -> getObjects(new Criteria("lid", "(".implode(", ", $items_id).")", "IN"), true);
foreach(array_keys($items) as $cat_id){
foreach(array_keys($items[$cat_id]) as $item_id){
$item_obj =& $items_obj[$item_id];
$items[$cat_id][$item_id] = array(
"title" => $item_obj -> getVar("title"),
"uid" => $item_obj -> getVar("submitter"),
"link" => "singlevideo.php?lid={$item_id}",
"time" => $item_obj -> getVar("date"),
"tags" => tag_parse_tag($item_obj -> getVar("keywords", "n")),
"content" => "",
);
}
}
unset($items_obj);
}
function xoopstube_tag_synchronization($mid)
{
// optional
}
?>
I assume the error is caused by
$item_handler =& xoops_getModuleHandler("xoopstube","xoopstube");
but I don't know how to fix this.
Anybody who can help me with this??
TIA!
McDonald