Forums / Setup & design / load counter - how to?

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

eZ debug

Timing: Jan 19 2025 07:22:46
Script start
Timing: Jan 19 2025 07:22:46
Module start 'content'
Timing: Jan 19 2025 07:22:47
Module end 'content'
Timing: Jan 19 2025 07:22:47
Script end

Main resources:

Total runtime1.4847 sec
Peak memory usage4,096.0000 KB
Database Queries202

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 588.9297180.8438
Module start 'content' 0.00631.3576 769.7734624.2813
Module end 'content' 1.36390.1208 1,394.0547337.3984
Script end 1.4846  1,731.4531 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.2358210.0002
Check MTime0.00130.0909210.0001
Mysql Total
Database connection0.00080.054610.0008
Mysqli_queries1.402794.47732020.0069
Looping result0.00230.15632000.0000
Template Total1.452497.820.7262
Template load0.00170.112720.0008
Template processing1.450797.711520.7254
Template load and register function0.00010.005410.0001
states
state_id_array0.00190.127610.0019
state_identifier_array0.00160.110420.0008
Override
Cache load0.00140.0924360.0000
Sytem overhead
Fetch class attribute can translate value0.00130.088740.0003
Fetch class attribute name0.00130.085980.0002
XML
Image XML parsing0.00160.111140.0004
class_abstraction
Instantiating content class attribute0.00000.0012100.0000
General
dbfile0.00440.2983440.0001
String conversion0.00000.000430.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 24
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs