Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Simple counter to display file downloads
I had placed a simple counter on my homepage that counted the number of times a file was downloaded.
I recall that it was a dead simple piece of code and it worked. I deleted it but now i can no longer find it. I have a need for it. Cant recall if i found it here at Txp or elsewhere. It was not DB based as I recall.
any suggestions?
…. texted postive
Offline
Re: Simple counter to display file downloads
Perhaps txp:file_download_downloads?
TXP Builders – finely-crafted code, design and txp
Offline
Re: Simple counter to display file downloads
;-) that sounds right.
but if i want to track a particular fiel what is the syntax”?
<p>
Downloads:
<txp:file_download_downloads />
</p>
do i replace this with a filename? or will it count all downloads of all files in a directory?
<txp:file_download_downloads />
thanks!
…. texted postive
Offline
Re: Simple counter to display file downloads
No, it has go within a txp:file_download_list wrapper. Without that it doesn’t know which file id to show.
For example, this will produce a link to the file with the ID# 123
with the number of downloads i brackets after it.
<txp:file_download_list id="123">
<a href="<txp:file_download_link />">
<txp:file_download_name />
</a> (downloaded <txp:file_download_downloads /> times)
</txp:file_download_list>
Change the file_download_list
to determine which files will be output, e.g. to output all files in the category public_downloads
(you need to create that file category and assign your files to it first) use:
<txp:file_download_list category="public_downloads">
or to show the top ten file downloads by number of downloads:
<txp:file_download_list limit="10" break="li" wraptag="ol" sort="downloads desc">
and so on… You can find more inspiration in Phil’s files.txp form.
TXP Builders – finely-crafted code, design and txp
Offline
Re: Simple counter to display file downloads
Added a second example for possible similar requests.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Simple counter to display file downloads
thanks all! i have it (file download counter) working again
…. texted postive
Offline