113
It appears to me, that ajaxify is far slower than xajax on the ajaxify demo site?!? AND if you want to process form data even the ajaxify code is a bit longer (can be seen in the demo). But you are right, xajax has some ugly drawbacks (unless someone has a solution to implement xajax as framework code so that it can be used anywhere anytime), so I will try ajaxify for a few functions, but I ask you to give me a helping hand. Will you?
I take just a basic example. What the script has to to do is select a radio station and shows the players that can be used with that radio station.
PHP 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;
}
HTML code:
<{$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>
I would like to see how this can be done with ajaxify. I just want to emphasize, that I don't want you to code for me, but just give me a little push into the right direction.
HINT HINT