Forums / Setup & design / ezbinaryfile download_count

ezbinaryfile download_count

Author Message

Daniel Guerrier

Wednesday 27 July 2005 11:33:23 am

The table definition for the ezbinaryfile table has a column for download_count. How is this updated?
Am I expect to update this value manually or is there a machanism that is supposed to maintain this field?

Thanks,
Danny

Daniel Guerrier

Friday 29 July 2005 8:42:56 am

Anyone???

Daniel Guerrier

Friday 29 July 2005 9:14:49 am

This is all I can find in the docs, but it does not help much.

 

The number of times the file has been downloaded through the "download" view of the "content" module.

Luc Chase

Friday 29 July 2005 9:19:40 am

sh-2.05$ find * -name \*.php | xargs grep 'download_count'
kernel/classes/datatypes/ezbinaryfile/ezbinaryfile.php: 'download_count' => array( 'name' => 'DownloadCount',
kernel/classes/datatypes/ezbinaryfile/ezbinaryfiletype.php: $db->query( "UPDATE ezbinaryfile SET download_count=(download_count+1)

The Web Application Service Provider

Daniel Guerrier

Friday 29 July 2005 11:40:40 am

Maybe I'm asking the wrong question.

I would like to keep track of the number of times a file is downloaded. I saw that line of code when I inspected that file. But how exactly am I supposed to use that to perform this task?

The doc says the "download" view is provided to give an interface to download files.
http://ez.no/doc/ez_publish/technical_manual/3_6/reference/modules/content/views/download

how exactly is this supposed to be used?

Daniel Guerrier

Sunday 31 July 2005 9:29:02 am

does anyone have an idea how to use the content/download view i.e what parameters it takes and what it is supposed do?

Łukasz Serwatka

Sunday 31 July 2005 1:15:41 pm

Hi,

Download counter is updated everytime when user click file to download, this is simple counter. To display download count of file use code

{if ne( $node.object.data_map.file.content.download_count, 0 )}
    {$node.object.data_map.file.content.download_count|wash}
{else}
    0
{/if}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Daniel Guerrier

Sunday 31 July 2005 8:03:38 pm

I got that part. The real question is how do I use the download view to create the download file links?

Is it as simple as:

$node.object.data_map.file.content.download

Łukasz Serwatka

Sunday 31 July 2005 11:16:03 pm

Then use

{def $attribute=$node.object.data_map.file}

<a href={concat( 'content/download/', $attribute.contentobject_id, '/', $attribute.id, '/file/', $attribute.content.original_filename|urlencode )|ezurl}>{$attribute.content.original_filename|wash</a>

It always good to look in design\standard\templates\content\datatype\view\ directory

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Daniele Nocentini

Thursday 03 June 2010 6:21:29 am

Ho can I update the count of download every time the page was refreshed?

Antica Bottega Digitale srl
http://www.abd.it

Gaetano Giunta

Friday 04 June 2010 4:54:51 am

use set-block for var cache_ttl (there are about a thousand posts about that var in the forums, and a concise example in the reference manual online in the page "template functions"/"set-block"

ciao

Principal Consultant International Business
Member of the Community Project Board