ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How do I code link in EE to open a Word or PDF document?

February 09, 2011 3:56pm

Subscribe [2]
  • #1 / Feb 09, 2011 3:56pm

    ladams1949

    100 posts

    Can someone share what the code should be for a link to download and/or potentially launch a Word or PDF file?  And what EE {path} type variables might be best to use?

    As always, any and all help is very much appreciated.  Thanks!!  Larry A.

  • #2 / Feb 09, 2011 6:21pm

    Rob Allen

    3114 posts

    First create a File type custom field for the actual file, eg “download-file”

    Then add the field short name in your template as the HREF attribute:

    <a href="http://{download-file}">Download</a>

    EE will automatically add the path to the file, based on what you’re set up in File upload preferences.

  • #3 / Feb 09, 2011 9:03pm

    ladams1949

    100 posts

    Rob, I tried this, but the user defned field did not resolve.  Came through uninterpreted.  I’ll play with a bit more, but if any suggestion should come to mind, will certainly appreciate.  Thanks.

  • #4 / Feb 10, 2011 10:00am

    Sue Crocker

    26054 posts

    Hi, ladams1949.

    Make sure your custom field is a File field type, and name it something like pdf-view.

    Then inside the entry, upload a .pdf file. Does the upload work?

    If you put in {pdf-view} inside your exp:channel:entries loop, does something show up in the display?

  • #5 / Feb 10, 2011 10:06am

    ladams1949

    100 posts

    Sue, I’m on 1.6.9, and I did not see a field type of “File” as being available when I set up the section custom field.  Is that perhaps the problem, that I am not defining this field in the correct place?  As it is, I have it defined as “text”.

    Thanks!

  • #6 / Feb 10, 2011 10:14am

    Sue Crocker

    26054 posts

    Duhh.. my mistake. 😊 But the concept is the same.. make sure you control the naming of the field, and set the formatting to be None.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases