driuwt9557
2013-08-01 18:40
浏览 28
已采纳

Drupal 7 - 以编程方式标记节点

I am trying to populate the content of a Drupal 7 site programatically by reading from a CSV file. I have all the code for that, but the next step is to automatically tag each node with a series of terms found in 3 different columns.

Now I know that I can tag the node using the term id, but is there a way to tag using the term name?

I'm looking at something like this where $tags is an array of strings that are supposed to be tag terms.

$a = 0;
foreach ($tags as $tag) {
  $node->field_tags[$node->language][]['a'] = $tag;
  $a++;
}

I appreciate any help I can get. Thanks!

图片转代码服务由CSDN问答提供 功能建议

我试图通过读取CSV文件以编程方式填充Drupal 7站点的内容。 我有所有代码,但下一步是使用3个不同列中的一系列术语自动标记每个节点。</ p>

现在我知道我可以使用标记节点 术语id,但有没有办法使用术语名称进行标记?</ p>

我正在查看类似这样的内容,其中$ tags是一个字符串数组,应该是标记术语 。</ p>

  $ a = 0; 
foreach($ tags as $ tag){
 $ node-&gt; field_tags [$ node-&gt; language] [] ['  a'] = $ tag; 
 $ a ++; 
} 
 </ code> </ pre> 
 
 

我感谢任何帮助。 谢谢!</ p> </ div>

1条回答 默认 最新

相关推荐 更多相似问题