By tkgafs on
How are file attachments added into $content
I am using CCK and Catgeory modules with drupal 4.7 to create a specific page type
but I can't find out how to display details of any attachments a node might have, but if I simply print $content they are included in it
I dont want to print $content because if a weburl field is added to the node using cck, then it is also printed in $content
see these examples
This link uses the various cck fields without using $content
any suggestions greatfully received
Tkgafs
Comments
I should have said I'm using
I should have said I'm using the attachment module and the filemanager module
Create attachments list $files manually with CCK templates
I use this in the CCK template to manually reproduce the attached files
any chance..
thanks for posting that snippet...v. helpful.
Any chance you have a zip file of the icons?
Dub
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
CCK table view of attachments
Hi,
I've maden a cck table view of attachments nodes, you can see it at http://www.clubslotsevilla.es/clasificaciones . These views have two fileds:
node: title (normal) ------------------------ file: name (with download link)
Do you konw how could I include a icon beside of "file: name" for a certain type of files?
Attachment Icons Download
Here is a download link for the icon images:
http://www.easytouch.com/drupal/attachment_icons
Thanks for the excellent
Thanks for the excellent code.
Marcel
Wholesale Directory
Cool snippet but ...
It's a cool snippet, but it actually only applies to the default/core attachment module, not the filemanager/attachment one.
In the latter case you use $attachments instead of $files. The issue I'm having is in regards to the active/n directories that are used by the filemanager to store node specific attachments seperately (so I understand). And the $attachments variable only gives the filename and not the subdirectory the file is in.
Anyway to get around this and get the full file path?
Thanks,
Mike
try using the variable_get
try using the variable_get function
Marcel
http://www.acmetutorials.com
Revised cck template code to show $attachments
Thank you all so much for the help with this. Marcel really pointed me in the right direction on this one.
Here's the revised cck template code to show attachments when using the filemanage and attachment modules. I'm not 100% sure that I've written this so that it takes advantage of the filemanager's private file handling. I don't use that feature, so all my attachments are saved in the "active" directory rather than the "working" directory.
It might be a little sloppy, but it works for me in 4.7.4. The real benefit of using some sort of variation on this code is that you can take advantage of the "hidden" file option, as well as use both the title and description fields.
A couple of notes:
1. I added the div tag so that I could customize the CSS. It's not necessary.
2. This code checks to see if any of the attached files are NOT selected as hidden. If all are hidden, the table does not show up in the node body.
2. I added a conditional statement that checks to see if the description field is empty for all non-hidden attachments. If all are empty, it skips this column in the table and does not print the "description" header.
Follow-up:
It would be great to add "odd/even" tags, and maybe play with the table headers a bit more. But it does what I need at the moment.
Cheers,
Sean
Sean Larkin
printing the newest on top?
Hi Sean,
very, very nice piece of code. Exactly what I need. What do I have to do to print it the other way round so that the newest attachment is always on top. Probably easy but my PhP is very meagre. Any help would be very much appreciated.
cheers, xl
In 5.x (must be there in 4.x
In 5.x (must be there in 4.x too),
<div id="attachments">is causing fatal error, remove it and also remove</div>on third last lineUse this instead