Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
'custom' field for a file
Hey!
I need another field to the files page beside “Description”
to add the ID of an image to a file
Last edited by THE BLUE DRAGON (2008-11-10 11:40:25)
Offline
Re: 'custom' field for a file
OK I found a way to use the Description field as “2” fields like
using the “ied_replacer” plugin
I have the JW FLV Media Player that play music/video from an XML page
and I want to just use the files page to upload a file
and point on the image ID#, track name & date
without a need to post another article
now the date and the track name it’s not a problem
(using the Date & Description fileds like daaa…)
but where to write the image id#?
so here is a trick:
1. download and install the plugin: ied_replacer
2. edit the plugin and add this line:
case 'description': $what=$GLOBALS['thisfile']['description']; break;
after:
case 'message': $what=$GLOBALS['thiscomment']['message']; break;
3. add this line:
'[title]' => 't.jpg</image>
<creator>'@
before:
);
extract(lAtts(array('what' => false), $atts));
and click save
(you can change “[title]” to any name you want)
4. create a page like this
(you can use file category and sort the list as you want):
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>
<txp:file_download_list form="files" limit="999" sort="created desc" />
</trackList>
</playlist>
5. create a new form for files or use the default “files” like this:
<track>
<title>(<txp:file_download_created format="%d.%m.%y" />)</title>
<location>http://www.domain.com/files/<txp:file_download_name /></location>
<image>http://www.domain.com/images/<txp:ied_replacer what="description" /></creator>
</track>
6. upload a file and edit the Description field like this:
1[title]Artist - title
so now just change “1” to your image id#
and change “Artist – title” to the artist name and title
and that’s it!
your XML playlist page will look like this:
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>
<track>
<title>(10.11.08)</title>
<location>http://www.domain.com/files/filename.mp3</location>
<image>http://www.domain.com/images/1t.jpg</image>
<creator>Artist - Title</creator>
</track>
</trackList>
</playlist>
and if you want to know why the hell I done all this?
becouse it will be much more easy for the client to manage the music/videos
only from the files page and will not need to open another article for each file
I hope you got the point and you can use it for other things for files
until a plugin for custom file fields will show up and save us all the trouble ;)
Offline
Pages: 1