Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Customise the file download list
I am displaying a file download list that is curently written as links to the file downloads:<code> <ol> <txp:file_download_list form=“filesNoList” category=“mp3” sort=“downloads desc” /> </ol></code>
and in the filesNoList form:<code>
<li><txp:file_download_link><txp:file_download_name /></txp:file_download_link>: <txp:file_download_description /> [<txp:file_download_downloads />]</li>
</code>
But I want to change it to make each item in the list link to the article which includes that particular file (not the download link itself), so you can view the information associated with it before choosing wheter to download it.
Is this possible? As I write this I realise that a file isn’t associated exclusively with a single article. I guess the only way to make it work would to make sure the file had exactly the same name as the article, then you could rewrite the link manually.
Have I just answered my own question or is there another way?
Offline
#2 2005-11-25 19:30:27
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Customise the file download list
Have I just answered my own question…?
Pretty much. :) You may find my plugin useful for this.
Offline
Re: Customise the file download list
Thanks Mary
I already had your plugin installed, but must have forgotten work out how to use it ;)
Its almost what I want, but I want it to display the number of downloads, so I tried this:
<code> <li><txp:permlink><txp:title /></txp:permlink>: <txp:file_download_description /> [<txp:file_download_downloads />]</li> </code>
The <code><txp:file_download_description /> </code> seems not to do anything, which is no big worry.
The <code><txp:file_download_downloads /></code> displays the number of downloads for the currently viewed article – repeatedly for every item on the list, rather than the number of downloads specific each individual item on the list. So they all seem to have been downloaded the same number of times. If you are not looking at an article’s page then they all display as blank. I’m guessing there’s no way around this because it’s in an article form, but perhaps you know different!
Offline
#4 2005-11-26 00:23:19
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Customise the file download list
How exactly are you using these particular tags? I suspect from your results that you’re just dumping those tags into the article body or form. As described in the plugin help, the ones you’ve mentioned get used by other tags. They are the “guts”.
You need to place these within their own form, then place <txp:upm_article_file_list form="form_name" />
within your article form.
Offline
Re: Customise the file download list
I have a misc form (called ‘downloadChart’) which contains:<code><ol class=“download”><txp:upm_file_packets_article_custom form=“filesNoList” category=“audio”/></ol></code>
and in the filesNoList article form:<code><li><txp:permlink><txp:title /></txp:permlink>: <txp:file_download_description /> [<txp:file_download_downloads />]</li></code>
I think thats what you just suggested… but then its late, I might be having a brainwrong :-o
Offline
#6 2005-11-26 11:43:09
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Customise the file download list
I think thats what you just suggested…
Nope, not quite. :) Based upon the attempt you’ve just posted here, try with the following adjustments.
“filesNoList”:
<li><txp:permlink><txp:title /></txp:permlink> <txp:upm_article_file_list form="other_form" /></li>
“other_form”:
<txp:file_download_description /> [<txp:file_download_downloads />]
Is that what you’re after?
Offline
Re: Customise the file download list
That’s almost it!
Only thing I’d like different is that it should display the list by number of downloads. At the moment its displaying by date.
Is that possible?
Offline
#8 2005-11-29 17:23:02
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Customise the file download list
Yes. Anything you can do with file_download_list, you can do with upm_article_file_list.
Offline
Re: Customise the file download list
Thanks for being patient Mary, I’m having a bit of trouble geting my head around this one… the penny will drop any minute now, I promise ;)
Using your code above, the ‘listNoFiles’ form would become: <code><li><txp:permlink><txp:title /></txp:permlink> <txp:upm_article_file_list form=“downloadChart” sort=“downloads” /> </li></code> right? Only it doesn’t change the display order – they are still displayed by date.
Just to be extra clear, this is what I have:
- In the page template:<code><ol class=“download”><txp:article_custom form=“filesNoList” category=“audio” /></ol></code>
- In filesNoList (an article form):<code><li><txp:permlink><txp:title /></txp:permlink> <txp:upm_article_file_list form=“downloadChart” sort=“downloads” /> </li></code>
- And in downloadChart (a file form):<code><txp:file_download_description /> [<txp:file_download_downloads />]</code>
Is there anything you can see that might be wrong?
Offline
#10 2005-11-29 22:57:54
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Customise the file download list
…would become…
Again, no. What you have now, and what I told you to use, is correct. There is no attribute named “sort”, it is “sortby”.
Offline
Re: Customise the file download list
Hi Mary
I left this a while hoping the txp fairies would fix it, but it didn’t happen!
The thing I am still stuck on is the display order. I can’t make it do anything other than display by filename. It’s supposed to be a Download Chart so if it’s not ordered by number of downloads its kinda pointless ;) To refresh… rather than a simple list of links to downloads, I want a list of links to the article o which the download is attached, but display the list according to the download count.
Anything you can do with file_download_list, you can do with upm_article_file_list.”
so i tried adding the sort attribute
there is no attribute named “sort”, it is “sortby”.
the attribute in the wiki for <a href=“http://textpattern.net/wiki/index.php?title=Txp:file_download_list_/”>file_download_list</a> is <code>sort=“sort by” </code>… is this a mistake? Or are the attributes different for your plugin?
Can you confirm which attribute is correct, and where I should place it:- In the page template like this? <code><ol class=“download”><txp:article_custom form=“filesNoList” category=“audio” sort=“downloads” /></ol></code>
- Or in filesNoList (an article form) like this? <code><li><txp:permlink><txp:title /></txp:permlink> <txp:upm_article_file_list form=“downloadChart” sort=“downloads” /> </li></code>
again, any help is much appreciated!
Offline
#12 2005-12-22 07:48:13
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Customise the file download list
Okay, digging into code…
It looks like, for whatever reason, that file_download_list is indeed using sort. It shouldn’t be, because that’s confusing; it’s name shouldn’t matter, but it should be the same attribute name everywhere (everywhere else it is sortby).
At the moment:
upm_article_file_list doesn’t accept sort or sortby or any equivalent attribute. Sorry that I said it did, I’d gotten confused. It used to, but hasn’t for a while.
Within the article itself, the files are listed in exactly the order you enter them into the custom field; not by filename or any other sorting mechanism. It is only upm_file_packets_article which has the sorting action.
That all said:
I’ll re-introduce a sorting attribute to the plugin, and it will be sortby. Check the updated help doc. I’ll be posting the updated plugin shortly.
Offline