Xajax+smarty, the problem is urgent!
My refreshcontent function can not be called, I have been troubled by this problem for several days, is to find out where the problem is, I hope you help me see, thank you!
The code is as follows:
xajax_smarty.php
Require_once (' config/config.inc.php ');
Require_once (' xajax/xajax_core/xajax.inc.php ');
$xajax = new Xajax ();
function Loadcontent ($n) {
Global $ Smarty;
if ($n ==0) {
$data [] = array (' title ' = ' HelloWorld ', ' content ' = '
What's going on?
');
$data [] = array (' title ' = = ' Another item ', ' content ' = ' = ')
Nothing fancy
');
}
else if ($n = = 1) {
Echo ' ============= ';
$data [] = array (' title ' = ' Dynamically loaded ', ' content ' = '
There you go
');
}
$Smarty->assign (' posts ', $data);
$ret = $Smarty->fetch (' post.html ');
$Smarty->clear_all_assign ();
return $ret;
}
function Refreshcontent ($formValues) {//cannot be called
echo "LDKFJDL";
$response = new Xajaxresponse ();
$newContent = loadcontent ($formValues [' select_page ']);
$response->addassign (' content ', ' InnerHTML ', $newContent);
return $response;
}
$xajax->registerfunction (' refreshcontent ');
$xajax->processrequest ();
$Smarty->assign (' content ', loadcontent (0));
$Smarty->assign (' Xajax JavaScript', $xajax->getjavascript (' xajax/'));
$Smarty->display (' main.html ');
?>
Post.html
<%{foreach from = $posts item = post}%>
<%{$post .title}%>
<%{$post .content}%>
<%{/foreach}%>
Main.html
<%{$xajaxjavascript}%>
Smarty $amp; xajax
<%{$content}%>
http://www.bkjia.com/PHPjc/632483.html www.bkjia.com true http://www.bkjia.com/PHPjc/632483.html techarticle Xajax+smarty, the problem is urgent! My refreshcontent function can not be called, I have been troubled by this problem for several days, is to find out where the problem is, I hope you help me to see, Xie ...