By dpw on
Hi all,
In the phptemplate documentation for modifying node.tpl.php, I don't see the attribute to include attachments.
I have created a file (node-flexinode-6.tpl.php) and created a custom display of the individual elements (i.e. not using the $content variable). I can get all of the information to be displayed, but my attachements are not shown.
Is there a function to call, which will display attachments if there are any? What is the best way of handling this?
Thanks!
Comments
Make sure you enable the
Make sure you enable the list checkbox in attachments.
attachments are enabled for
attachments are enabled for this content type. If I rename my custom template, I get attachments, otherwise I don't. Somehow $content has the link for attachments but I don't know how to access them if I don't use the generic $content.
Click on edit on the
Click on edit on the flexinode page the attachments are not showing up, scroll down and make sure checkbox for list in the attachments box is ticked on (you should get delete, list, url and size).
yes, 'list' is selected. I
yes, 'list' is selected.
I appreciate you trying to help bdeli. Its a good idea to make sure that the standard settings are correct before proceeding. My feeling, though, is that the problem lies more in how flexinode and phptemplate interact.
Might have not understood you
Might have not understood you properly but where do you want the attachment to be listed - Summary view or in Extended view? Secondly are you using the file or the attachment module?
I just edited a flexinode I am using on a website I am working on, included a new content type (file) and uploaded one file. The attachment shows in extended view but not in summary view since you will need to include the custom flexinode display for that field in the summary section.
Just extended, not summary
Just the extended view, not summary (although there should be a way to do this in the summary view also). I am using the upload module.
Have you tried overriding the standard node template with your own? This is a very nice feature of Drupal which I am only starting to explore. If you build a new flexinode content type and you are using the phptemplate engine (which I understand is the default in 4.7), you can modify the default layout of fields. Fleximax tries to do this through an interface, but it adds a bunch of unwanted
any luck?
I want to be able to print attachments too (using both attachment module and upload module)
update
as of now, I do it by pasting code from 'view' parts of attachment or upload modules. Im guessing there is a more correct solution..
I would like to know that too!
I need to know how to show attachments in flexinodes (using attachment.module) also.
well, in your
well, in your node-flexinode-3.tpl.php (or whichever flexinode) add this before processing node->body further
foreach ((array)$node->attachments as $attachment) {
if ($attachment['working']) {
$file = module_invoke('filemanager', 'get_file_info', $attachment['fid']);
$workingurl = str_replace('&', '&', module_invoke('filemanager', 'url', $file, TRUE));
$activeurl = str_replace('&', '&', module_invoke('filemanager', 'url', $file, FALSE));
$node->body = str_replace($activeurl, $workingurl, $node->body);
$node->teaser = str_replace($activeurl, $workingurl, $node->bteaser);
}
}
$node->body = '
' . theme('attachments', $node);
-v
http://www.vjrao.com