This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Setup & design » Implementing Counters on EzPublish

Implementing Counters on EzPublish

Implementing Counters on EzPublish

Tuesday 22 July 2003 11:59:36 pm - 9 replies

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.


Modified on Wednesday 23 July 2003 12:00:00 am by Hermano Correia

Wednesday 23 July 2003 10: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.

Wednesday 23 July 2003 11: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.

Thursday 24 July 2003 12:09:21 am

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.


Saturday 08 January 2005 6:05:56 pm

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.

Tuesday 22 February 2005 4:09:40 am

has anyone already made such a hit counter?
thankshappy.gif Emoticon

Tuesday 22 February 2005 7:41:01 am

fficial" title=" Emoticonfficial"> Emoticonfficial

blunk.gif Emoticon Use Amos method if you don`t want build tpl operator

Modified on Tuesday 22 February 2005 8:48:23 am by Łukasz Serwatka

Tuesday 22 February 2005 10:05:08 am

This is a good tool:

It is not build into eZ Publish, but it does the job.
A build in counter in eZ Publish would be very nice happy.gif Emoticon

Modified on Tuesday 22 February 2005 10:08:10 am by Nicolas Heiringhoff

Tuesday 22 February 2005 3:43:39 pm

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

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. happy.gif Emoticon

Tuesday 22 February 2005 5:26:23 pm

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

Its quite easy and uses unfortunately no features of ez

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



You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from