You are not logged in.
Pages: 1
I’m working on the new Human Resources page on our corp intranet and I’ve had dozens of files submitted by them to be displayed for download on their page. Some of the filenames are quite long (and include an .ext of course) and while I can’t change the name of the actual files I would like to know how I could have them auto-truncated.
HR staff will be uploading/deleting files on their own and I have the following tag on their page.
<p><txp:file_download_list category=“HR-Benefits” form=“files” limit=“10” sort=“filename asc” />
Anyone have any ideas?
Thanks very much from a newbie!
Offline
Does rvm_substr help? It chops text at a specified number of characters.
Or perhaps the original sab_substr (also available on ruud’s page).
Last edited by Bloke (2008-06-12 15:13:46)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern.
Txp Builders – finely-crafted code, design and Txp
Offline
As file_download_list uses forms, you can as well put an smd_query of above bloke into that form, wich calls the desription from table txp_file you entered in the file’s description box.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
I’ll try that but the caveat scares me……I don’t currently have a backup of this site…am I taking to big a chance trying it?
Thanks
Offline
pmjewett wrote:
I’ll try that but the caveat scares me……I don’t currently have a backup of this site…am I taking to big a chance trying it?
Smaller than eating a tomato. Basically only one line of code, in example with sab_substr plugin:
<txp:sab_substr limit="30"><txp:file_download_name /></txp:sab_substr>
That goes to your files form.
Last edited by Gocom (2008-06-12 16:07:16)
Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />
Offline
Is there any way to remove the file extension?
e.g. with Podcast.mp3 as the file name
<txp:sab_substr limit="-4"><txp:file_download_name /></txp:sab_substr>
Or even if someone could tell me how to access the download_file_name global variable so I can change it in PHP like so:
<txp:php>
$name = $thisfile['filename'];
substr_replace($name ,"",-4);
echo $name;
</txp:php>
Thanks
Offline
To answer my own question…
<txp:php>
$name = file_download_name();
$name = substr_replace($name ,"",-4);
echo $name;
</txp:php>
Offline
Pages: 1