artfulrobot Posted September 16, 2022 Share Posted September 16, 2022 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 More sharing options...
szabesz Posted September 16, 2022 Share Posted September 16, 2022 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. https://github.com/gebeer/FieldtypeImageReference https://processwire.com/modules/inputfield-select-images/ (you might want to consider to borrow form the idea of this module and implement something like this but for non-image files) Hope this helps. 1 Link to comment Share on other sites More sharing options...
Robin S Posted September 16, 2022 Share Posted September 16, 2022 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. 5 Link to comment Share on other sites More sharing options...
artfulrobot Posted September 18, 2022 Author Share Posted September 18, 2022 Thanks, will check these solutions out. 1 Link to comment Share on other sites More sharing options...
artfulrobot Posted May 4, 2023 Author Share Posted May 4, 2023 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 More sharing options...
artfulrobot Posted May 5, 2023 Author Share Posted May 5, 2023 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. 1 Link to comment Share on other sites More sharing options...
bernhard Posted May 5, 2023 Share Posted May 5, 2023 If you are only handling a limited number of images you can also use RockImagePicker: https://processwire.com/talk/topic/27677-help-suggestions-on-reusing-a-background-image-across-a-site/ 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now