PHP 根据Vocab ID渲染分类术语
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 根据Vocab ID渲染分类术语相关的知识,希望对你有一定的参考价值。
function render_terms($node,$vocabid,$title=null,$divclass=null) {
$terms = taxonomy_node_get_terms_by_vocabulary($node, $vocabid );
if ($terms) {
$output = '<div class="field field-item'. ' '.$divclass .'"><div class="field-label-inline-first">' .$title .' </div> ' ;
$term_links = array();
foreach ($terms as $term) {
$term_links[] = l($term->name, taxonomy_term_path($term), array('attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description)))) ;
$output .= implode(", ", $term_links);
}
}
$output .='</div>';
return ($output);
}
以上是关于PHP 根据Vocab ID渲染分类术语的主要内容,如果未能解决你的问题,请参考以下文章