Wednesday, April 1, 2009

Display Attachment Attached Files by using Content Template

Display Attachment Attached Files by using Content Template

1. go to ?q=admin/content/templates.

2. Create template for a content type.

3. Enable Body

<?php print $node->content['body']['#value'] ?>


<?php
if (isset($node->files) && user_access('view uploaded files')) {
// Add the attachments list to node body with a heavy
// weight to ensure they're below other elements
if (count($node->files)) {
if (!$teaser && user_access('view uploaded files')) {
$node->content['files'] = array(
'#value' => theme('upload_attachments', $node->files),
'#weight' => 50,
);
}
}
}

print $node->content['files']['#value'];
?>

No comments: