Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-02-14 15:46:50

sthmtc
Member
From: CGN, GER
Registered: 2005-01-17
Posts: 586
Website

get the filename/link/description from a given file ID (in php)

i’m building some sort of flashvideoplayer that can handle multiple file IDs. these are stored comma separated in a custom_field entitled ‘video’. in the article form i’m now doing

<txp:php>
$video_ids = split(',',$thisarticle[video]);
foreach ($video_ids as $video){
...
}
</txp:php>

that works but i don’t understand how i can get the name/description/link of the file by its ID. i tried to call file_download_name($video) but that doesn’t work as it can only be used in file context. could someone point me in the right direction?

ps: i’m aware of the different plugins but i prefer to do this ‘manually’ in this case.
pps: i’m a php n00b :)

Offline

#2 2008-02-14 15:59:43

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: get the filename/link/description from a given file ID (in php)

<txp:php>
foreach (split(',',$thisarticle['video']) as $video)
{
  echo file_download(array('id' => $video, 'form' => 'video_form'));
}
</txp:php>

You can then use all the normal file tags inside a form called ‘video_form’ to output name, description, whatever.

Offline

#3 2008-02-14 16:48:00

sthmtc
Member
From: CGN, GER
Registered: 2005-01-17
Posts: 586
Website

Re: get the filename/link/description from a given file ID (in php)

perfect! thank you!

Offline

Board footer

Powered by FluxBB