Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2024-10-06 12:23:51

bashirnoori
Member
From: Afghanistan
Registered: 2012-10-02
Posts: 79

Files: Add an option of file URL near to download

When uploading files via the TXP Files feature, it would be helpful to have an additional button labeled “File URL” next to the “Download” button. Often, we need to link to PDF files directly in the article body rather than downloading them, which I currently do manually.

For example, I upload pdf file and I typically add links to the article body like this:
<a href="https://websitename.com/files/here-is-file-name-which-manually-insert.pdf">Open File</a>

This process requires manually typing the entire URL. If we had an option to easily copy the file URL from the files interface, and paste when need to add link in article body area.

Also, sometimes we need to paste that to other area like this:


<object data="https://websitename.com/files/here-is-file-name-which-manually-insert.pdf" type="application/pdf" width="100%" height="100%"></object>

Last edited by bashirnoori (2024-10-06 12:27:37)

Offline

#2 2024-10-06 12:59:35

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,419
Website GitHub

Re: Files: Add an option of file URL near to download

Is the stuff in the Tags column not close enough for your needs? On the Files list, if you tap the Tags>HTML option it gives you a full anchor link at the bottom of the popup box. That should fulfill your needs.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2024-10-06 18:43:04

bashirnoori
Member
From: Afghanistan
Registered: 2012-10-02
Posts: 79

Re: Files: Add an option of file URL near to download

I can see the download link there as well, like this
<a href="https://websitename.com/file_download/4/here-is-file-name-which-manually-insert.pdf">

Offline

#4 2024-10-07 07:00:02

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,138
Website

Re: Files: Add an option of file URL near to download

Yeah, there is currently no easy option to do that. You can ease the pain and save some typing by creating a short code and insert it in the article:

Step 1: create a form named “pdf” (name it what you want, though)

<txp:file_download id='<txp:yield name="id" />'>
<a href="/files/<txp:file_download_name />" target=_blank"><txp:file_download_name /></a> 
    [<txp:file_download_size format="mb" decimals="2" />]
</txp:file_download>

Step 2: Insert in your article (67 is the ID of my PDF file)

<txp::pdf id="67" /> 

And that is it. When the article is rendered you will see a link to your PDF file.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

Board footer

Powered by FluxBB