Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-11-15 23:38:51

richtestani
Plugin Author
Registered: 2009-11-08
Posts: 128

File download types

I notice there is no file_download_type tag, does any one know a way to output this?
Thanks
Rich

Offline

#2 2009-11-16 11:25:14

whaleen
Member
From: Portland
Registered: 2006-05-11
Posts: 373
Website

Re: File download types

Do you mean the file type as in .pdf, .xls, etc…?

You might look at plugins that do icon presentation handling based on the file type. From there you could modify some output, in a file form or otherwise, to present the file type information by it’s ‘type’.

Explore the plugins. Ask another question. Carry on!


txtstrap (Textpattern + Twitter Bootstrap + etc…)

Offline

#3 2013-07-12 02:05:42

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: File download types

Is there something new on this topic?

Offline

#4 2013-07-12 14:01:46

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: File download types

GugUser wrote:

Is there something new on this topic?

If you want the extension, you can do it pretty easily with basic PHP using pathinfo function:

<txp:php>
    echo pathinfo(parse('<txp:file_download_name />'), PATHINFO_EXTENSION);
</txp:php>

Which could also be wrapped into rah_function:

<txp:rah_function call="pathinfo" file='<txp:file_download_name />' _constantOptions="PATHINFO_EXTENSION" />

Last edited by Gocom (2013-07-12 14:02:24)

Offline

#5 2013-07-12 14:36:50

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: File download types

Thank you for this information.

I would like to have better knowledge of PHP, and now I know one detail more.

Offline

#6 2013-07-12 16:34:51

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: File download types

The PHP snippet works fine, but not inside a smd_macro.

Offline

Board footer

Powered by FluxBB