#78 I would like to know how many times each file was downloaded

Next_Release
open
nobody
None
1
2014-05-02
2013-03-14
Anonymous
No

I would like to know how many times each file was downloaded

Discussion


  • Anonymous
    2014-05-02

    Here is the code ( by Alessandro )

    Add a integer column, counter, in the file table.

    In template fileList add a th on line 25:
    <?php $this->_tag_stack[] = array('tr', array()); $_block_repeat=true;smarty_block_tr($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat);while ($_block_repeat) { ob_start(); ?>Downloads<?php $_block_content = ob_get_contents(); ob_end_clean(); $_block_repeat=false;echo smarty_block_tr($this->_tag_stack[count($this->_tag_stack)-1][1], $_block_content, $this, $_block_repeat); } array_pop($this->_tag_stack); ?>

    In template fileList add a td on line 83:
    _tpl_vars['rid']; ?>
    " style="text-align:right"><?php echo $this->_tpl_vars['f']['counter']; ?>  

    In template fileList add a td on line 99:
    _tpl_vars['rid']; ?>
    ">

    Add the following logic in lib/modules/default/files.inc.php on line 402:
    $filec=$finfo[$num];
    $filec['counter']=$finfo[$num]['counter']+1;
    app()->db->update('files',$filec,array('id' => $finfo[$num]['id']),array('counter'));

     
  • The above code is wrong. Why are you modifying the templates_c files???? It's INSANE!
    Please modify the fileList.tpl file in templates/default and simply add a column in the html table (also add the header).

    {$f.counter}
     
    Last edit: Alessandro Briosi 2014-05-02


Anonymous


Cancel   Add attachments