SmartFAQ 由 SmartFactory(https://www.smartfactory.ca)开发,它是 InBox Solutions(https://www.inboxsolutions.net)的一个部门。

如何使 xoopsformhidden 符合 xhtml 标准?
备注:我不知道这是否真的是一个常见问题解答。但在我制作页面符合 xhtml 标准的过程中,这个问题让我感到困扰。有两种可能的解决方案。1. 在模块内创建一个带有另一个表单元素的托盘。2. 对整个系统进行更改,这对非 PHP 技师来说要简单得多。查找 include/xoopsform/xoopsformhidden.php 中的 render 函数以及读取以下行:
return ".$this->getName()."' id='".$this->getName()."' value='".$this->getValue()."' />";
此代码的问题在于,隐藏字段的输入将插入到表格的 tr 行之间,这不是 xhtml 标准。只需将上述行更改为
return ".$this->getName()."' id='".$this->getName()."' value='".$this->getValue()."' />";
我所做的一切只是插入另一行表格。为了防止新表格行被显示,我使用了 style display:none。就是这样!


评论归作者所有。我们不对其内容负责。
user

 这些解决方案的问题


我遇到了相同的有效性问题。

我在渲染函数中做了这个更新,但这些函数似乎还用于(至少一个)其他地方。

使用此修改,当您要更新一个模块(在模板修改后),更新和取消按钮就放在标题下方...

 
user

 另一个解决方案


大家好,我最终找到了另一种解决方案(多亏了一位xoops-france成员)...

没有必要修改formhidden.

首先,只需修改文件class/themeform.php,将以下代码替换为

} else {
    
$ret .= $ele->render()."n";
}

替换为
} else {
    
$hiddens .= $ele->render()."n";
}


并在该行后面添加以下代码
$ret .= "
n";

替换为
$ret .= "".$hiddens."n";


现在函数render()将生成有效的HTML表单。

对于联系模块,还有另一个修改。实际上,没有必要修改一个表单来使用模板,XOOPS可以做得很好。因此,在文件modules/contact/index.php中注释掉上面的两行
...
$xoopsOption['template_main'] = 'contact_contactusform.html';
...
$contact_form->assign($xoopsTpl);


然后在modules/contact/contactform.php中添加以下一行
$contact_form->display();

在最后一个 $contact_form->addElement 之后

完成,你现在将拥有一个有效的 HTML 联系表单。

 


Login

Who's Online

288 user(s) are online (19 user(s) are browsing XOOPS FAQ)


Members: 0


Guests: 288


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Aug 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Did you know ?

You can prevent selected objectionable words ever being published on your site?

Random question

Whenever I try to add a new block, it always shows up for Webmasters only.
No matter what I try, there seems to be no way to make it display for any other group. Other blocks are fine, but not custom ones.
How can I make blocks that display for groups other than Webmasters?