Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-03-19 22:13:34

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 596
Website

Using file_download_list as a container?

Am I misunderstanding or misusing file_download_list? This code:

<txp:if_custom_field name="acclaim-comma-separated-file-id">
  <txp:file_download_list order="modified desc" limit="3" id='<txp:custom_field name='acclaim-comma-separated-file-id' />' />
    <a href='<txp:file_download_link />' title='<txp:file_download_name /> -- <txp:file_download_modified format='%c' />'>Acclaim (most recent, pdf)</a><br />
  </txp:file_download_list>
</txp:if_custom_field>

Outputs this:

file: example.pdf [228.25KB]
Category: category1
download: 1
file: example2.pdf [518.95KB]
Category: category1
download: 1
file: example3.pdf [141.43KB]
Category: category1
download: 1

Why doesn’t it display the way I specified between the file_download_list tags?

(I swapped out a bunch of quotes for single quotes trying to troubleshoot…thanks to Ruud for his previous help)

Last edited by maruchan (2011-03-19 22:13:51)

Offline

#2 2011-03-19 22:32:11

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

Re: Using file_download_list as a container?

Too much quote swapping won’t work.
If you only want to display 1 download link by using an ‘id’, then there’s no need to specify limit and sort order.

<txp:if_custom_field name="acclaim-comma-separated-file-id">
  <txp:file_download_list id='<txp:custom_field name="acclaim-comma-separated-file-id" />'>
    <a href="<txp:file_download_link />" title="<txp:file_download_name /> -- <txp:file_download_modified format="%c" />">Acclaim (most recent, pdf)</a><br />
  </txp:file_download_list>
</txp:if_custom_field>

PS. which TXP version are you using? The file_download_list tag can be used as a container tag in TXP 4.0.7 and higher and the ‘id’ attribute was introduced in TXP 4.2.0.

Last edited by ruud (2011-03-19 22:36:50)

Offline

#3 2011-03-19 22:35:39

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 596
Website

Re: Using file_download_list as a container?

Edit: Reading Ruud’s reply before getting hasty

Last edited by maruchan (2011-03-19 22:36:00)

Offline

#4 2011-03-19 22:37:28

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: Using file_download_list as a container?

You are self closing your initial file_download_list tag, it won’t operate as a wraptag that way. It’s just going with the defaults and skipping the rest.

Offline

#5 2011-03-19 22:39:07

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

Re: Using file_download_list as a container?

^^ oops. I completely missed that.

Offline

#6 2011-03-19 22:40:17

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 596
Website

Re: Using file_download_list as a container?

Ruud: Sorry, probably shouldn’t have created this new thread…I didn’t realize the problem was going to be so similar. :-)

I have one custom field, but it will be used in two ways: Short form and long form. The short form will only display the latest 3 files in the custom field. The long form will show them all. So in this case, I definitely want to display 3, even if the author has entered something like “4, 24, 1, 9, 39.”

TXP version 4.3.

Offline

#7 2011-03-19 22:46:30

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 596
Website

Re: Using file_download_list as a container?

You are self closing your initial file_download_list tag, it won’t operate as a wraptag that way. It’s just going with the defaults and skipping the rest.

Oh, crap. Thank you for spotting that, Rick. I corrected the typo, used “sort” instead of “order,” and put all my quotes back (thanks Ruud).

So — this worked:

<txp:if_custom_field name="acclaim-comma-separated-file-id">
  <txp:file_download_list sort="modified desc" limit="3" id='<txp:custom_field name="acclaim-comma-separated-file-id" />' ><a href="<txp:file_download_link />" title="<txp:file_download_name /> -- <txp:file_download_modified format="%c" />">Acclaim (most recent, pdf)</a></txp:file_download_list>
</txp:if_custom_field>

Offline

Board footer

Powered by FluxBB