16-4
                        上課範例:include/notification.inc.php
                    
                
                                
<?php
if (!defined('XOOPS_ROOT_PATH')) {
	die("XOOPS root path not defined");
}
function get_tad_note($category, $item_id)
{
	if ($category=='global') {
		$item['name'] = '';
		$item['url'] = '';
		return $item;
	}
	global $xoopsDB;
	if ($category=='cate') {
		$sql = 'SELECT cate_title FROM ' . $xoopsDB->prefix('tad_note_cate') . ' WHERE cate_sn = '.$item_id;
		$result = $xoopsDB->query($sql); // TODO: error check
		$result_array = $xoopsDB->fetchArray($result);
		$item['name'] = $result_array['cate_title'];
		$item['url'] = XOOPS_URL . '/modules/tad_note/index.php?cate_sn=' . $item_id;
		return $item;
	}
}
?>