1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

resource view counter

Discussion in 'XenForo Development Discussions' started by arpitjain, Jul 23, 2013.

  1. arpitjain

    arpitjain Member

    how to add number of views a resource has gotten ..in right sidebar ...
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    You are posting in the wrong forums.

    Moved.
     
  3. arpitjain

    arpitjain Member

    i want to add number of views a resource has gotten in right sidebar of my page ...
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    To which page? The individual resource page?

    I'm also not sure that XenForo tracks views on resources, so you would most likely need to develop an add-on to accomplish this.
     
  5. arpitjain

    arpitjain Member

    index page where resource title in left side and downloads and votes in right side ...i want to add view has gotten by each resource after downloads ....and resource categories can be selected by left column........on resource list page
     
  6. Jeremy

    Jeremy XenForo Moderator Staff Member

    Just verified, the Resource Manager does not track views of an individual resource. You would need a custom add-on developed to track the views.
     
  7. arpitjain

    arpitjain Member

    please send me the related notes to customize this add on...
     
  8. Jeremy

    Jeremy XenForo Moderator Staff Member

    I suggest looking at how XenForo tracks thread views. Implementing this will take a decent add-on a bit of work to accomplish. The "notes" you so wish me to send do not exist.
     
  9. arpitjain

    arpitjain Member

    thanks ..
     
  10. arpitjain

    arpitjain Member

    i am creating a add on to count resource view for that i have create addon from ACP also create a folder in library (view counter) in this i put Listener.php and also create a template for views but i want to put the output of this template in resource_list_item template
    in following code


    <div class="listBlock resourceStats">
    <div class="listBlockInner">
    <xen:include template="rating">
    <xen:set var="$rating">{$resource.rating_avg}</xen:set>
    <xen:set var="$hint">{xen:if '{$resource.rating_count} == 1', {xen:phrase 1_vote}, {xen:phrase x_votes_plural, 'count={$resource.rating_count}'}}</xen:set>
    </xen:include>
    <div class="pairsJustified">
    <xen:if is="!{$resource.is_fileless}"><dl><dt>{xen:phrase downloads}:</dt> <dd>{xen:number $resource.download_count}</dd></dl></xen:if>
    <dl><dt>{xen:phrase updated}:</dt> <dd><a href="{xen:link resources/updates, $resource}" class="concealed"><xen:datetime time="{$resource.last_update}" /></a></dd></dl>
    </div>
    </div>
    </div>

    to put its output in this template its hook is require....how i will find hook and what code i have to put in Listener.php
     
  11. arpitjain

    arpitjain Member

    i create a add on to to show number of view a resource has gotten it show text view where i want ....but how to show number of views a resource has gotten my listener.php code is
    <?php
    class viewcounter_Listener
    {
    //Our callback signature! We are using here! Look:
    public static function template_hook1($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
    {
    //Yey! its our template hook!
    if ($hookName == 'page_container_head123')
    {
    //Our tab! We will do somethin better, hang on.
    $contents .= 'view';
    }
    }
    }
    ?>
    i want to show number of views with this text for that do i have to create column in xf_resource table and how i will insert in it and how to fetch this ...please reply
     
    Last edited: Jul 24, 2013
  12. arpitjain

    arpitjain Member

    to show with resources number of view a resource has gotten i have created an add on ........
    i want to add a column in database table to handle views ....when someone click on resource to view i want to update view column for that view resource id and want to fetch view value for each id ...how can i do it..for resources i have model resources.php...please help
     
  13. arpitjain

    arpitjain Member

    i want to add a column for views a resource has gotten in my xf_resources table.... how can i do it ...can i add direct to table ...and how can i fetch its value for each resource shown on my page...or template resource_index ...or i have to change in model..please reply
     
  14. Brogan

    Brogan XenForo Moderator Staff Member

Share This Page