Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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
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,
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
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