Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Conditional use of Files?
I have a unique (maybe temporary, but who knows) situation where I’m using PDF files for translations of selected blog content. It doesn’t warrant using MLP (lack of admin/webmaster on the part of the client) so it’s a simpler compromise.
The idea I was hoping to employ is simple in concept to other if conditional situations, where if the PDF file exists, the links is shown, but if not, nothing is output.
But I guess I’m playing outside of the rules because it doesn’t seem to be working. Here’s what I’m trying:
<txp:if_custom_field name="PDF translation">
<txp:file_download_link id='<txp:custom_field name="PDF translation" />' /> <txp:file_download_name title="1" /> [PDF, <txp:file_download_size format="b" decimals="2" />]
</txp:file_download_link>
<txp:else />
</txp:if_custom_field>
I also tried it without the conditional wrap, but that doesn’t work either. In both cases all content following the code doesn’t show up in the containing div (in this case the main content area).
Any other clever ways to do this with tags alone?
Offline
Re: Conditional use of Files?
The opening file_download_link
tag closes itself. You should remove the closing slash, i.e.
<txp:if_custom_field name="PDF translation">
<txp:file_download_link id='<txp:custom_field name="PDF translation" />'>
<txp:file_download_name title="1" /> [PDF, <txp:file_download_size format="b" decimals="2" />]
</txp:file_download_link>
</txp:if_custom_field>
Note that if you fancy about using the PDF translation
custom field as attribute in tags (like in article_custom), you will need to turn it into single word (ie. PDF_translation).
Offline
Re: Conditional use of Files?
Ha! Two easy overlooks. Thanks, Jukka!
Offline
Pages: 1