• Resolved postoffice33

    (@postoffice33)


    Hi,

    I was working with the plugin and when I installaed (and enabled) W3 Total Cache, the counters are not updated anymore.

    This is because currently the plugin generates in the page/post html code a <script> tag that includes the file top-10-addcount.js.php (that server-side increments the counters in the mySql DB).

    Unfortunately when you enable browser caching tags, the browser will NOT do this request if the page has been already visited (and cache is not expired).

    The solution to this is to do an AJAX call AND to add a random parameter value in order to have always a different URL, so avoid that the browser cache (again!) the same.

    So I changed the file top-10.php at line 75:

    $output = '<script>jQuery.ajax("' .$tptn_url. '/top-10-addcount.js.php?top_ten_id=' .$id. '&top10_rnd=" + (new Date()).getTime() + "-" + Math.floor(Math.random()*100000));</script>';

    This will ensure that the AJAX call is always done and the server can update the counters.

    Note that the changes is applied only to global stats counter (not the daily one that I am not using).

    BYE
    Angelo

    http://wordpress.org/extend/plugins/top-10/

Viewing 5 replies - 31 through 35 (of 35 total)
Viewing 5 replies - 31 through 35 (of 35 total)
  • The topic ‘Changes to have Top10 plugin working with W3 Total Cache’ is closed to new replies.