Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-11-26 12:13:11

simoin
Member
From: Ireland
Registered: 2009-02-10
Posts: 50
Website

Use number in custom field for file download id

I want to used the file id which is stored in a custom field in the
<txp:file_download /> tag

The name of the custom field holding the file id is “document”

I know the follwing doesnt work but I can’t figure it out,
any help much appreciated.

<txp:file_download form="files" id="<txp:custom_field name="document" />"/>

Offline

#2 2009-11-26 12:32:34

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

Re: Use number in custom field for file download id

Might want to read Textpattern.com Weblog / Tag parser – part 1: new features. Use single quotes ' if you want the attribute be parsed.

<txp:file_download form="files" id='<txp:custom_field name="document" />' />

Offline

#3 2009-11-28 00:50:38

simoin
Member
From: Ireland
Registered: 2009-02-10
Posts: 50
Website

Re: Use number in custom field for file download id

Thanks I’ll check it out, I have came across a solution to this using PHP,
from this article,

http://awasteofwords.com

I outputted the form below which includes a PHP snippet,
the article is very thorough and explained clearly.

<txp:output_form form="download id" />

<txp:php> $a = custom_field (array ('name' => 'document')); echo file_download(array( 'id' => $a, )); </txp:php>

Offline

#4 2009-11-28 12:52:03

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Use number in custom field for file download id

That article is out of date. The raw PHP solution still works, but using tags within tags as you tried initially, with Jukka’s correction, does exactly the same thing and in the true “Textpattern way”, much more elegant. Try it…


Code is topiary

Offline

Board footer

Powered by FluxBB