Нужно выводить <div class="factory"><b>Название словаря:</b> термин1, термин2, термин3...</div>
Пробовал так:
<?php<div class="factory">
<b><?php $vid = 9; $vocabularyname = taxonomy_vocabulary_load($vid)->name; print $vocabularyname; ?>:</b>
<?php if (count($taxonomy)):
$terms = taxonomy_node_get_terms_by_vocabulary($node, 9);
if ($terms) {
foreach ($terms as $key => $term) {
$itemsuse[] = $term->name;
}
print implode(', ', $itemsuse);
} endif; ?>
</div>?>
Но не знаю как поставить условие, если нет терминов, то не выводить название словаря.
Что-то запутался с этим кодом и условием к нему.
Прошу помощи!
peace
Комментарии
Ну просто строчку где выводится имя словаря помести в условие count($taxonomy) и всё...
Сделал, не сработало
<?php if (count($taxonomy)):
$vocabularyname = taxonomy_vocabulary_load(12)->name;
print $vocabularyname;
$terms = taxonomy_node_get_terms_by_vocabulary($node, 12);
if ($terms) {
foreach ($terms as $key => $term) {
$itemsuse[] = $term->name;
}
print implode(', ', $itemsuse);
} endif; ?>
Выводит имя словаря все равно при любых условиях...
тогда под $terms засунь.
<?php if (count($taxonomy)):
$vocabularyname = taxonomy_vocabulary_load(12)->name;
$terms = taxonomy_node_get_terms_by_vocabulary($node, 12);
if ($terms) {
print $vocabularyname;
foreach ($terms as $key => $term) {
$itemsuse[] = $term->name;
}
print implode(', ', $itemsuse);
} endif; ?>
ТОЧНО!
Огромное спасибо!
да фигня))основы php.