Jump to content

Shared files?


artfulrobot
 Share

Recommended Posts

Adding a files field to a template means that when I edit a page I am able to upload new files to use on that page.

However, sometimes I want one file (say Annual Report) to be featured on a number of pages. Is there any way to reference a file on another page instead of uploading a 2nd copy of the file? The problem with 2 files is that they could get out of sync if they are updated, and of course, they take 2× the storage.

Or is the only/correct way to do this:

  • Create a template (do we call these page types?) "shared files"
  • Create a shared files page: "Annual report", upload the pdf.
  • Create a page reference field to allow users to select from shared files.
  • The template for that page ref field follows the chain to return the file.

Thanks.

Link to comment
Share on other sites

Hello,

6 hours ago, artfulrobot said:

Or is the only/correct way to do this:

Let's say that is the simplest way to do it.

A couple of other ideas that might or might not suit your needs if you upload an image representing the PDF:

https://processwire.com/modules/inputfield-selectize/

Pages selectable via Inputfield Selectize can have their own PDF files uploaded to them and that way you can make those PDFs sharable across the admin.

There are similar modules for images only but they are probably not what you need.

Hope this helps.

  • Like 1
Link to comment
Share on other sites

7 hours ago, artfulrobot said:

However, sometimes I want one file (say Annual Report) to be featured on a number of pages.

If by "featured" you mean "linked to within a CKEditor field" then it's pretty easy. You just upload the file to the first page it will be used on (Page A), and on any of the other pages you use the CKE link dialog to select Page A and then select the file.

image.png.fd66adb8b161689c3a46e95c30f2fe27.png

image.png.7238be23f80ff5f136ec13d29014d5b2.png

  • Like 5
Link to comment
Share on other sites

  • 7 months later...

I'm experimenting with this stuff practically now.

I've since learnt that file fields can themselves use fields ("custom fields"), which is sort of what I suggested at the top of this post, but with the template hidden, and with a UI that embeds/nests the UI for these file pages. Tentatively it could work for a file to belong to a page (I have a reservation around whether the file would ever be needed when the page wasn't, but decided to push that complexity to the future!) so I thought maybe this was the way to go.

I set up some fields for my 'files' field: title, description (text fields) both work fine, but when I put an image field on there it doesn't show in the UI? I wanted to include a thumbnail of each file. Is this a known limitation?

 

Link to comment
Share on other sites

I've decided that for my use-case, a better solution is to have a 'resources' page and template, and a 'resource' template which has a singular file field and use one page per file. Then to use page reference fields to include that in actual visitable pages. This enables me to include an image field for my files, as well, of course as all the other fields I need for files.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...