Drupal: how to add pdf links to a block?

I've some blocks in my Drupal website with some text. I need to other some links in the text, to pdfs (and upload them from back-end). Can I add some upload fields to the block pages, and link them from the text ? thanks

asked Jan 6, 2011 at 7:59 64.4k 100 100 gold badges 278 278 silver badges 494 494 bronze badges

4 Answers 4

Check out the Insert module, which allows you to upload files to a FileField and then easily link to them from within the node body.

answered Jan 6, 2011 at 8:10 6,139 1 1 gold badge 31 31 silver badges 27 27 bronze badges I've just installed, it seems it doesn't solve my issue with blocks Commented Jan 6, 2011 at 9:16

Ah, sorry about that, I somehow missed the part(s) where you said "blocks". I don't know of anything offhand to allow you to achieve this with blocks, but I'll update my answer if I think of anything.

Commented Jan 6, 2011 at 22:39

I usually just end up attaching them to a node and then linking them manually. Not the answer you were probably looking for, but it works.

answered Jan 6, 2011 at 23:02 637 5 5 silver badges 13 13 bronze badges

If you have views module available you can create a view that lists the pdfs attached to a particular node, using the node id (nid) as an argument, or use more complicated arguments if you want, as long as the fields displayed in the view are the the filefields you used for your pdf you can get pretty creative with how the pdfs are organized.

It's somewhat tricky to get arguments into views blocks but it's certainly possible, using panels, or using other tricks. More info on that: here: http://drupal.org/node/150482 here: http://drupal.org/node/695124 http://drupal.org/node/161867#comment-1086587

answered Jan 7, 2011 at 1:16 1,831 2 2 gold badges 13 13 silver badges 15 15 bronze badges

Might not actually help you, but the D7 version of http://drupal.org/project/block_api creates fieldable blocks, which means that you can attach any type of fields to created blocks.

For D6, the solution is more complex I guess. You could create a separate content type, attach the files there (by using Inline, FileField, . ). Then, either write a custom module that exposes a block for each node of that type and then renders the node in those blocks or use Views to create a view of a single node. Using views would be a bit overkill I guess but should be relatively fast if you can use caching..

answered Jan 10, 2011 at 6:16 6,891 2 2 gold badges 27 27 silver badges 38 38 bronze badges

Related

Hot Network Questions

Subscribe to RSS

Question feed

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2024 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2024.9.9.14969