function render()
{
$ele_name = $this->getName();
$ret = ';
$ret .= '
';
if (($desc = $ele ->getDescription()) != '') {
$ret .= '<div class="xoops-form-element-help">'. $desc . '</div>
';
}
$ret .= '. $class . '">' . $ele->render() . '' . NWLINE;
} else {
$ret .= '' ;
if (($caption = $ele->getCaption()) != '') {
$ret
.=
'. ($ele->isRequired() ? '-required' : '') . '">';
$ret .= '' "' . $caption . '';
$ret .= ';
$ret .= '*' ;
$ret .= '
《;
}
$ret
.= '《. $class . '" cols-pan="2">'
. $ele->render() . '';
. $ele-》render() . '';
} else {
$hidden .= $ele->render();
}
}
$ret .= '' Solution.$hidden .= NWLINE .= '' .= NWLINE;
$ret .= $this->renderValidationJS(``)`true);
return $ret ;
}
// 创建表单对象
$my_form = new ThemeForm("my form", 'Form_bien', "handle_bien.php?action=save");
// 创建表单组件
$reference = new XoopsFormText("Reference", "reference", 50, 100);
$prix= new XoopsFormText("Price","price",50,100);
// 将组件添加到表单中
$my_form->addElement($reference,true);
$my_form->addElement($price, true);
// 创建/添加按钮
$button = new XoopsFormButton('', 'post', _SEND, 'submit');
$my_form->addElement($button);
// 显示表单
$my_form->display();
class MyForm extends XoopsThemeForm{
}
?>
include_once(./../XoopsThemeForm.php)
class MyForm extends XoopsThemeForm{
}
?>
定义 XOOPS_ROOT_PATH 或退出(('XOOPS_ROOT_PATH') or die('Restricted access');
加载 xoops_load('XoopsThemeForm');
class MyForm extends XoopsThemeForm {}
加载 xoops_load('XoopsThemeForm');
class MyForm extends XoopsThemeForm {
private $newAction;
public function setNewAction($url=null){
if ($url===null){
$this->newAction=$this->getAction();
}
}
}
?>
xoops_load('XoopsThemeForm');
class MyForm extends XoopsThemeForm {
private $newAction;
public function setNewAction($url=null){
$url===null?$this->newAction=$this->getAction(): $this->newAction=$action;
}
function render()
{
$ele_name = $this->getName();
$ret = ';
$ret .= '
';
}
如果 (( $描述 = $ele -> getDescription() ) != '') {
$ret .= '' . $描述 .. '
';
$ret .= '. $class . '">' . $ele->render() '' . NWLINE;
} $else {
$ret .= '' ;
if (($caption = $ele ->getCaption()) != '') {
$ret .= '. '$ret .= ' ';'
) '
定义('XOOPS_ROOT_PATH') or die('受限访问');
class MyElement extends XoopsFormElement
{
var $_content;
function __construct($caption = '', $value = '', $name = '') {
$this->setCaption($caption);
$this->setName($name);
$this->_value = $value;
}
function setContent($content) { $this->_content=$content;
}
function getContent($encode=false){ return $encode ? htmlspecialchars($this->_content, ENT_QUOTES) : $this->_content;
}
function render() { $this->getContent(); }
}
?>