2
1) Elements from the form are assigned to Smarty by using $testform->assign($xoopsTpl); instead of $testform->display(); in which case the form and its elements (the HTML code and attributes) are assigned to a Smarty array.
2) If Javascript is added to the form, this will be inserted at that specified point
3) <{$variablename}> is a Smarty tag, which takes the assigned "name" attribute from the form and puts it in place of the <{$testform.name}>
4) <{foreach}> is a Smarty tag
Check out
http://smarty.php.net for more information on Smarty and how to use it - just remember that XOOPS uses <{ and }> as tags, where Smarty default uses { and }