load counter - how to?

Author Message

Marko Žmak

Sunday 13 March 2005 11:51:25 am

I want to count how many times a certain image was loaded and displayed. So I created a new class with an image and a counter. Each time an object of this class is displayed somewhere on my page I want to decrease it's counter.

How do I do that?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Bård Farstad

Monday 14 March 2005 5:08:54 am

Marko,

eZ publish already has functionality to analyze the apache logfile to figure out how many times an article is viewed. This information can also be retrieved with an operator. More information about this can be found here:
http://www.ez.no/ez_publish/documentation/reference/data_fetching/content/view_top_list

For efficiency and due to view caching I recommend analyzing the apache logs. They contain the information and is already stored anyways.

--bård

Documentation: http://ez.no/doc

Marko Žmak

Saturday 19 March 2005 5:10:50 pm

> eZ publish already has functionality to analyze the apache logfile

How do I use this functionality?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Łukasz Serwatka

Sunday 20 March 2005 11:38:17 pm

Hi Marko,

1. Configure settings/cronjob.ini
Add the following line:
Scripts[]=updateviewcount.php

2. Configure settings/logfile.ini
[AccessLogFileSettings]
#Where could find the apache log
#Example StorageDir=/var/log/httpd/
StorageDir=
#Example LogFileName=test.ezpublish.no
LogFileName=

Template example of fetch top 10 most popular articles in section 1 ( article class id is 2 )

{let view_list=fetch('content','view_top_list',hash(section_id,1,class_id,2,limit,10,offset,0))}
{section show=$view_list}
{section name=ViewList loop=$view_list sequence=array(bglight,bgdark)}
        <a href={concat("/content/view/full/",$ViewList:item.node_id)|ezurl}>
        {$ViewList:item.name}
        </a><br />
{/section}
{/section}
{/let}

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

Marko Žmak

Monday 21 March 2005 4:06:59 pm

Thanks for the help. I need only one thing more...

This template only shows the most popular articles, but how do I get the exact load count for an article from this. For example if I want to display on my page how many times an article was viewed?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.