Using Smarty Template Engine with Xajax Toolkit
Are you having a hard time making Smarty and Xajax to work together? Then, this guide is for you. Setting up Smarty and Xajax to work together requires no tricks but a lot of patience is a must.
< ?
/* include all the required functions and class files */
include('libs/smarty.class.php');
include('xajax.inc.php');
/* end */
/* instantiate the smarty templating engine */
$body = new Smarty();
/* end */
/* instantiate the ajax class and register functions*/
$xajax = new xajax();
/* debug output */
//$xajax->debugOn();
/* register your ajax functions */
$xajax->registerFunction(’addFormInput’);
$xajax->registerFunction(’processAddForm’);
/* end */
/* process ajax request then assign and call xajax javascript for your smarty template */
$xajax->processRequests();
$body->assign(’ajax_script’, $xajax->getJavascript());
$body->display(’index.html’);
?>
Lastly, call the ajax_script variable in your index.html template.

Thats all about it.
Spread the word
del.icio.us Digg Furl Google StumbleUpon Technorati Windows Live Yahoo! Help
Trackback uri
http://seoroot.com/blog/computing/using-smarty-template-engine-with-xajax-toolkit.html/trackback



















1 Comment on Using Smarty Template Engine with Xajax Toolkit »
SIAKOI MOI! » Blog Archive » Smarty - PHP Template Engine @ 11:31 pm (Pingback)
[…] Using Smarty Template Engine with Xajax Toolkit […]