Код выводит в блоке список прикреплённых к документу файлов.
<?php
if (arg(0) == 'node' && is_numeric(arg(1)) && is_null(arg(2))) {
$nid = (int)arg(1);
$files = upload_load(node_load($nid));
$output = theme_upload_attachments($files);
return $output;
}
?>
Чтобы блок показывался только в том случае, если к документы файлы прикреплены, то в параметры видимости блока можно добавить код:
<?php
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
$files = $node->files;
foreach ($files as $file) {
if ($file->list) {
return TRUE;
} else {
return FALSE;
}
}
}
?>
Комментарии
Ищу сниппет вывода последней картинки (imagefield) в блок на главную