继续Drupal分享精神 QQ群:107748121 站长QQ:2275288328 skype: hellodrupal【drupal交流+drupal 建站+theme制作】
登录 注册

drupal node body min_word_count 设置,添加主体内容字数设置

在写hook_node_info()的时候,如果设置了min_word_count =10 ,可是已经输入了超过10汉字,应该可以了。但是还是错误,说字数太短。就觉得很奇怪,只好注销这个设定。这几天终于发现了这个min_word_count的设置意义。 大概看看下面的定义就会明白。 // Make sure the body has the minimum number of words. // todo use a better word counting algorithm that will work in other languages if (isset($node->body) && count(explode(' ', $node->body)) < $type->min_word_count) { form_set_error('body', t('The body of your @type is too short. You need at least %words words.', array('%words' => $type->min_word_count, '@type' => $type->name))); } count(explode(' ', $node->body)) ,它是按照空格来算的,一个空格算一个词语,对英文来说就是min_word_count这么多个单词,而不是字节数。但是如果中文,大概就是十句话了。 "the minimum number of words." 最小的单词数量,而非字节。

评论

看不懂。不过每次来,都点了你二下google广告

看不懂。不过每次来,都点了你二下google广告

发表新评论

此内容将保密,不会被其他人看见。
  • 自动将网址与电子邮件地址转变为链接。
  • 自动断行和分段。
  • You can use BBCode tags in the text.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

更多关於格式化选项的信息

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.