TYPO3:如何在保存前提醒 RTE 中的字符数?
我面临着在后端保存大量内容的问题。我想限制用户的最大字符数。
在保存记录之前,我想在超出限制时提醒用户。
I am facing a problem with saving large content in the backend. I want restrict the users with a mximum number of characters.
Before saving the record, I want to alert the user if the limit is exceeded.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
困难的部分可能是您要保存的是富文本内容。因此,如果内容太大,您无法真正告诉用户删除某些字符,因为格式设置也会算作文本字段中的额外空间。
最简单的解决方案是更改 Typo3 网站的
tt_content
表中的bodytext
字段。使其类型为LONGTEXT
,最多可容纳 4GB 的内容。另一种解决方案是连接保存按钮,或添加一个验证内容的自定义保存按钮。您可以在此处找到添加自定义保存按钮的扩展:
http://typo3.org/extensions/repository/view/marit_savedocemail/current/ info/
请参阅此文件,它执行邮件发送(即:将检查长度):
http://typo3.org/extensions/repository/ view/marit_savedocemail/current/info/class.user_hook_t3lib_tcemain.php/
这个文件,添加按钮:
http://typo3.org/extensions/repository/ view/marit_savedocemail/current/info/class.ux_alt_doc.php/
所以你可以做的就是安装这个扩展,看看它是否有效,然后改变它满足您的需求:)
希望有帮助:)
The hard part is probably that it is richtext content that you are trying to save. So you can't really tell the user to remove some characters if the content is too big, because formatting will also count as extra space in the text field.
The easiest solution is to alter the field
bodytext
in thett_content
table of your Typo3 website. Make it of the typeLONGTEXT
, this can hold upto 4GB of content.Another solution would be to hookup the save button, or add a custom save button that validates the content. You can find an extension adding a custom save button here:
http://typo3.org/extensions/repository/view/marit_savedocemail/current/info/
See this file, that does the mailing (ie: would check the length):
http://typo3.org/extensions/repository/view/marit_savedocemail/current/info/class.user_hook_t3lib_tcemain.php/
And this file, that adds the button:
http://typo3.org/extensions/repository/view/marit_savedocemail/current/info/class.ux_alt_doc.php/
So what you could do is install this extension, see if it works, then alter it to your needs :)
Hope that helps :)