Implementing Counters on EzPublish

Author Message

Hermano Correia

Tuesday 22 July 2003 2:59:36 pm

I am new on EzPublish. I would like to have ideas on how to make a counter hit on the first page of site, to show how many visitours I have received.

Any help will be very welcome.

Thanks

Jan Borsodi

Wednesday 23 July 2003 1:06:58 am

You should create a small script which keeps the visitor count in a database table and include the script in index.php.

You could place the include right before the
include_once( 'kernel/classes/ezsection.php' );
line in index.php.

Ofcourse you would need to know PHP and SQL to do the rest.

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Hermano Correia

Wednesday 23 July 2003 2:57:29 pm

Thank you for your answer. I know a little from PHP and SQL, but I think I cannot use PHP directly on templates of the eZ publish, or am I wrong? I already have a script I use on plain PHP sites, what should I change to use it with EZ, should I make a module?

Thanks in advance for any help, and forgive me if the questions are too basic.

Bård Farstad

Wednesday 23 July 2003 3:09:21 pm

You could actually also do this using a template opreator. This operator would then be used in pagelayout.tpl. The opreator could e.g. save a number in a file, or database, which would be counted everytime the page is accessed.

-bård

Documentation: http://ez.no/doc

Steve Brown

Saturday 08 January 2005 9:05:56 am

I'm very surprised that eZ publish doesn't include a counter that you can place in a toolbar. It would probably be more useful than the 'user information' tool.

xiao jc

Monday 21 February 2005 7:09:40 pm

has anyone already made such a hit counter?
thanks:)

Łukasz Serwatka

Monday 21 February 2005 10:41:01 pm

http://www.google.pl/search?q=hit+counter&sourceid=mozilla-search&start=0&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:pl-PL:official
http://www.phpfreaks.com/tutorials/6/0.php

;-) Use Amos method if you don`t want build tpl operator

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

Nicolas Heiringhoff

Tuesday 22 February 2005 1:05:08 am

This is a good tool:
http://www.phpee.com/index.php?node=21

It is not build into eZ Publish, but it does the job.
A build in counter in eZ Publish would be very nice :-)

http://www.heiringhoff.de

Bung Rudi

Tuesday 22 February 2005 6:43:39 am

i've wrote a module for counter.
you can have it on request. send an email to bungrudi@gmail.com.

anyways, its very easy to implement/write one yourself. basically you just make a table in mysql or make a counter class with only integer attribute in it (and then instantiate a class of it). the script/module should check $_SESSION['counter'] (or define any other session variable if you wish), if it is set to false or !isset() (or any other value u defined), then it will increment the counter value by one and set $_SESSION['counter'] to true. if $_SESSION['counter'] is true, do nothing.

thats all. :)

Heiner Wurbs

Tuesday 22 February 2005 8:26:23 am

Hi,
I'm using a hack since some weeks and uploaded it for this topic into the contribs:

http://www.ez.no/community/contribs/hacks/stats_for_specific_urls

Its quite easy and uses unfortunately no features of ez

Maybe you can improve it and use it for your requirements.

Regards,
Heiner

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

eZ debug

Timing: Jan 30 2025 22:24:35
Script start
Timing: Jan 30 2025 22:24:35
Module start 'layout'
Timing: Jan 30 2025 22:24:35
Module start 'content'
Timing: Jan 30 2025 22:24:36
Module end 'content'
Timing: Jan 30 2025 22:24:36
Script end

Main resources:

Total runtime0.9304 sec
Peak memory usage8,192.0000 KB
Database Queries92

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 588.2344151.2109
Module start 'layout' 0.00580.0035 739.4453220.6875
Module start 'content' 0.00930.9204 960.13284,785.2734
Module end 'content' 0.92970.0007 5,745.406319.8438
Script end 0.9303  5,765.2500 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.3822160.0002
Check MTime0.00130.1379160.0001
Mysql Total
Database connection0.00080.084210.0008
Mysqli_queries0.826888.8688920.0090
Looping result0.00080.0868900.0000
Template Total0.875794.120.4378
Template load0.00210.222720.0010
Template processing0.873693.899820.4368
Template load and register function0.00110.121510.0011
states
state_id_array0.00170.183710.0017
state_identifier_array0.00100.112320.0005
Override
Cache load0.00190.1998490.0000
Sytem overhead
Fetch class attribute can translate value0.00150.158790.0002
Fetch class attribute name0.00170.1816140.0001
XML
Image XML parsing0.00550.592490.0006
class_abstraction
Instantiating content class attribute0.00000.0024140.0000
General
dbfile0.00650.7009380.0002
String conversion0.00000.000940.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
10content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
13content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
8content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 37
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs