简体   繁体   English

如何在后端TCA中限制tx_news预告片和正文的长度?

[英]How to limit tx_news teaser and bodytext length in Backend TCA?

For limiting the maximum length of a news title, i can use this tsConfig setting: 为了限制新闻标题的最大长度,我可以使用以下tsConfig设置:

TCEFORM.tx_news_domain_model_news.title.config.max = 70

Is it possible to set such a limitation also for teaser and bodytext of news records? 是否可以对新闻记录的预告片和正文进行同样的限制? Since these are not simple input fields but textareas or RTE fields, it doesn´t seem to be that easy to limit their length. 由于这些不是简单的输入字段,而是textareas或RTE字段,因此限制其长度似乎并不那么容易。 Is it possible nevertheless? 但是有可能吗?

max does not apply to RTE fields. max不适用于RTE字段。 You can try to limit the length in an editor plugin, eg CK Editor Plugin (for TYPO3 8). 您可以尝试限制编辑器插件的长度,例如CK Editor插件 (用于TYPO3 8)。 Keep in mind that there is not server side length validation. 请记住,没有服务器端长度验证。

typo3conf/ext/news/Resources/Private/Partials/List/Item.html查看typo3conf/ext/news/Resources/Private/Partials/List/Item.html ,您可以找到设置settings.cropMaxCharacters ,因此,如果设置plugin.tx_news.settings.cropMaxCharacters = 150显示的文本最多为150个字符。

Your Typoscript is correct for title and syntax is also correct: TCEFORM.[table name].[field].config.[key] = value 您的Typoscript title正确,语法也正确: TCEFORM.[table name].[field].config.[key] = value

TCEFORM.tx_news_domain_model_news.title.config.max = 70

If you want set limit for bodytext and teaser then try to below typoscript 如果要为bodytextteaser设置限制, bodytext尝试输入以下文字

TCEFORM.tx_news_domain_model_news.bodytext.config.Type = TEXT
TCEFORM.tx_news_domain_model_news.bodytext.config.Rows = 2

Also Add this typoscript in Root Page TSConfig. 还要在根页面TSConfig中添加此印刷文字。

More Details. 更多细节。 Click Here 点击这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM