Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2022-11-19 13:15:49

bybpow
New Member
Registered: 2022-11-19
Posts: 4

How do I create folders and subfolder in Files section?

I want to organice my files in folders and subfolder but I don’t know how to do it? Is it possible?

Offline

#2 2022-11-19 15:16:48

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,071
Website GitHub Mastodon Twitter

Re: How do I create folders and subfolder in Files section?

Hi and welcome to txp.

You can create categories for your files in Content>Categories—>Files and then allocate your files in those categories.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2022-11-20 14:14:42

bybpow
New Member
Registered: 2022-11-19
Posts: 4

Re: How do I create folders and subfolder in Files section?

Thank you for the info. So I can’t create folders in Files then, right? Do I have to use categories? Could that be implemented in the future?

Offline

#4 2022-11-20 14:32:35

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,705
Website

Re: How do I create folders and subfolder in Files section?

As colak mentioned, you can use categories and sub-categories to create the impression of nested folders on your website, but the files themselves are in a single folder. If you use the download code provided by the tag builder on the Content › Files panel, the links will always be of the form https://my.domain.com/file_download/123/file-name.pdf.

As alternatives, you could try:

  • smd_remote_file. It’s been a long time since I used this but it enables you to specify another url for a file that doesn’t even have to be on the same server.
  • jcr_file_custom. This allows you to add custom fields to file downloads. You could also use this to specify an alternative download url or file location that can then be in another folder. Not, however, that when you upload a file, it will be placed in the /files folder, and you will need to place it in the alternative download location yourself (essentially resulting in file duplicates). If you then remove that file the /files folder – to avoid duplicates – you’ll see a label the the file is “missing”, though that is then just be a cosmetic anomaly if you have the file elsewhere.
  • Say, for arguments sake, you already have a ton of files in subfolders that you’re trying to find a way of presenting. You could also use the Content › Links panel to link to them. That would avoid the duplication of files in the previous option, but the links panel doesn’t automatically determine the file size or file extension, etc. You could add those manually with link custom fields using jcr_link_custom.

TXP Builders – finely-crafted code, design and txp

Offline

#5 2022-11-20 14:51:31

bybpow
New Member
Registered: 2022-11-19
Posts: 4

Re: How do I create folders and subfolder in Files section?

Thank you too for the info, @jakob. I’m trying to nest as you say but it seems files can only have a single category. That is very limited in my opinion.
For example, in my case:
I got a video clip I want to use. As there’s only one common folder (I’d like to create folders for every post, it’d be the best for my case of use). I uploaded both my MP4 and PNG (for thumbnail).
I now want to create a parent tag “Clips” and then two child tags “Clip Edits (key tag for MP4)” and “Clip Thumbnails” so they are nested but as for now I can’t use the parent.
Is this correct or am I missing something?

Offline

#6 2022-11-20 16:02:21

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,705
Website

Re: How do I create folders and subfolder in Files section?

I’m guessing you’re looking for way to relate your clip thumbnail to your mp4 file.

One way is simply to use the same file name for your thumb and your mp4. Then you can loop over your category with the mp4s, chop off the file extension and tag on jpg/png, etc.

Untried, but I think you can do that with:

<txp:file_download_name trim="mp4" replace="jpg" />

Another option might be to upload your mp4s under Content › Files and your video thumbnails under Content › Images, then use jcr_file_custom to create a file custom field in which you store the corresponding image ID#. An advantage here is that if you also use smd_thumbnail you can then benefit from multiple thumbnail image sizes for responsive video poster images.

If you wish you can assign the video thumbnails to an own Image category but that’s then only for making it easy to filter in the admin area. It doesn’t serve any linking purpose.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB