Ik kan je verzekeren dat je op het verkeerde spoor zit. Neem van mij aan dat je in module-templates van CG - en ook in het algemeen - niet dergelijke logica nodig hebt.
Het moet in de {HitCounter} tag gebeuren zoals ik al eerder zei.
Ik weet niet welke versie je gebruikt (al die informatie liet je achterwege in je start post) maar bij mij is de help vrij duidelijk.
How Do I Use It
It is really simple, just place this string somewhere in your page template or content:{HitCounter}. By default, if no additional parameters are supplied hits will be tracked for the page id that this tag appears on. Additionally, it will output the number of unique hits. You could surround this output with some text.
For using this module in a module detail template you need to manually specify enough unique keys for the hitcounter to uniquely identify the article. Typically I would use something like {HitCounter key1="news" key2=\$entry->id}.
By default, the module outputs the number of unique views to that item. You can hide this output by using the assign parameter (see the cms_module tag). You can also change the output to view the number of unique hosts that have viewed the item by using the opt=hosts optional parameter.
Viewing Popular Items:
This module provides the ability to display a sorted list of the popular pages, or module records (for compatible modules).
{HitCounter action=popular [key1=string [key2=string]] [limit=number] [popular_template=string]}
Note: In order to use the "popular" action on module records, the module must implement a LinkDefinitionGenerator class to create LinkDefinition objects that are suitable for the module and the current request.
Known Items that are Compatible with the "popular" action:
Page: (default)
Create links to content pages.
CompanyDirectory:
Create links to CompanyDirectory items.
Merk op dat de closing bracket in de oorspronkelijke help niet stond (rood gemarkeerd)
ps. mocht je na deze uitleg vol blijven houden dat het in het template moet gebeuren dan zal ik niet meer reageren in dit topic. Tenzij blijkt dat je gelijk hebt, dan kom ik dat hier toegeven.