我已经7年没有使用Drupal了 仅当特定分类(词汇)中存在特定术语时,我才希望块的可见性
所以我进去只能选择整个词汇
在这种情况下,我想在“类别”中选择一个术语。
解决方案可以使用 PHP
类似...
<?PHP
if content taxonomyid=8
return TRUE; ?>
但是我忘了怎么做。
我找到了这个,但不起作用
$myterm = "mixes";
if ((arg(0) == 'node') && is_numeric(arg(1))) {
$terms = taxonomy_node_get_terms(arg(1));
foreach($terms as $term) {
if ($term->name == $myterm) return TRUE;
}
}