Erm, downloaded the module, looked at the code, but where is the connection to XAJAX? Did not found any function that is associated with XAJAX.
If you like, I give you a working example for a block. Just to be sure: XOOPS-Debug is turned off? And XAJAX-Debug is turned on (if there is any xajax)?
OK, give you the code anyway.
What does the xajax do is simple: query the database for radiostations, display it in a pulldown and depending on the kind of stream a button will be displayed.
Code for block:
function debaser_showradio() {
require_once DEBASER_ROOT.'/include/functions.php';
require_once DEBASER_ROOT.'/xajax/xajax_core/xajax.inc.php';
$xajaxb = new xajax();
if(isset($xajaxb)) $radio = &$xajaxb->register(XAJAX_FUNCTION, 'xajaxradio');
// Uncomment the next line for debugging purposes
//$xajaxb->setFlag('debug', true);
// this check for defines is because processRequest is not allowed
// to be started anywhere else at the same time, but this is only
// important if other modules or parts of the current module is
// using XAJAX
if (defined('_XDEBSINGLEFILE') || defined('_XDEBGENRE') || defined('_XDEBTV')) {
// do nothing here
} else {
$xajaxb->processRequest();
}
$Xjavapath = DEBASER_URL.'/xajax/';
$xajaxjavaradio = $xajaxb->getJavascript($Xjavapath);
global $xoopsDB;
$myts =& MyTextSanitizer::getInstance();
$block = array();
$block['xajax'] = $xajaxjavaradio;
$result = $xoopsDB->query("SELECT radio_id, radio_name, canplay FROM ".$xoopsDB->prefix('debaserradio')." ORDER BY radio_name ASC");
$radiolist = array();
$seloptions = '';
while (list($radio_id, $radio_name, $canplay) = $xoopsDB->fetchRow($result)) {
$seloptions .= '<option value="'.$radio_id.'">'.$radio_name.'</option>';
}
$radiolist['options'] = $seloptions;
$block['radiolist'][] = $radiolist;
return $block;
}
The XAJAX-function:
function xajaxradio($arg) {
global $xoopsDB;
$radioselect = $arg['radioselect'];
$result1 = $xoopsDB->query("SELECT radio_id, radio_stream, canplay FROM ".$xoopsDB->prefix('debaserradio')." WHERE radio_id = ".intval($radioselect)."");
list($radio_id, $radio_stream, $canplay) = $xoopsDB->fetchRow($result1);
$canplayarray = explode(' ', $canplay);
$result2 = $xoopsDB->query("SELECT xpid, name, html_code, playericon FROM ".$xoopsDB->prefix('debaser_player')." WHERE xpid IN (".implode(', ', array_map('intval', $canplayarray)).")");
$imagerow = '';
while($fetch = $xoopsDB->fetchArray($result2)) {
if ($fetch['html_code'] == 'external') {
$imagerow .= '<a href="'.$radio_stream.'" target="_blank"><img src="'.DEBASER_IMG.'/playericons/'.$fetch['playericon'].'" alt="'.$fetch['name'].'" title="'.$fetch['name'].'" />';
} else {
$imagerow .= '<button type="button" name="button'.$fetch['xpid'].'" id="button'.$fetch['xpid'].'" value="'.$fetch['xpid'].'" onclick="javascript:openWithSelfMain(''.DEBASER_URL.'/radiopopup.php?radio='+document.radiolist.radioselect.options[document.radiolist.radioselect.selectedIndex].value+'&player='.$fetch['xpid'].'','player',10,10)" /><img src="'.DEBASER_IMG.'/playericons/'.$fetch['playericon'].'" width="20" height="20" alt="'.$fetch['name'].'" title="'.$fetch['name'].'" /></button> ';
}
}
$content = $imagerow;
$objResponse = new xajaxResponse();
$objResponse->assign("radiolistresponse","innerHTML", $content);
return $objResponse;
}
The HTML for the block:
<{$block.xajax}>
<form style="margin:0px; padding:2px;" name="radiolist" id="radiolist" method="post" action="radio_block.php">
<select id="radioselect" name="radioselect" onchange="xajax_xajaxradio(this.options[this.selectedIndex].value)">
<option>-<{$smarty.const._MB_DEBASERRAD_CHO}>-</option>
<{foreach item=radiolist from=$block.radiolist}>
<{$radiolist.options}>
<{/foreach}>
</select>
</form>
<div id="radiolistresponse"></div>
HTH