Page 1 of 1
Multiple Hit Counter usages
Posted: Sat Dec 02, 2006 4:55 am
by jmcgin51
Is it possible to install Hit Counter more than once on a site? I'd like to keep a running count for the year, for example, but also reset the counter each month. So on my page I could show:
This page has been viewed {cms_module module=HitCounter} times this month.
AND
This page has been viewed {cms_module module=HitCounter} times this year.
I don't know much about modules. Could I just make a copy of the module and call it HitCounter2 or something like that, and then use {cms_module module=HitCounter2} as the tag? Probably not that simple, huh?
Re: Multiple Hit Counter usages
Posted: Sat Dec 02, 2006 6:24 am
by Dr.CSS
Only if you go thru all/the files and change hitcounter to hitcounter2 watch for upper/lower case sensitivity...
Can't hurt to try, it's always fun to experiment, that's the beauty of open source...
Re: Multiple Hit Counter usages
Posted: Sat Dec 02, 2006 3:43 pm
by jmcgin51
I tried changing all the hitcounter references to hitcounter2, but it didn't work. The admin section wouldn't even appear when I had a HitCounter2 directory in my Modules directory. Oh well...
Re: Multiple Hit Counter usages
Posted: Tue Dec 05, 2006 3:10 pm
by calguy1000
you also have to change the HitCounter.module.php to HitCounter2.module.php
Re: Multiple Hit Counter usages
Posted: Tue Dec 05, 2006 4:16 pm
by jmcgin51
yeah, I did that, but still no luck.
If I put the HitCounter2 directory in the Modules directory, I lose all the formatting in my Admin section, and I can't access the Modules page (it comes up blank.) I tried putting it in the module_custom directory; then my Admin is OK, and I can access the Module list, but HitCounter2 isn't listed as a module...
thanks
Re: Multiple Hit Counter usages
Posted: Tue Dec 05, 2006 5:08 pm
by calguy1000
when that happens there's usually an error in the output html or a php error or something. doing a view source, and searching for the word 'error' and/or looking at your httpd error logs should give you a hint.
Re: Multiple Hit Counter usages
Posted: Tue Dec 05, 2006 5:32 pm
by jmcgin51
looks like it's truly blank - here's the source of listmodules.php:
This is with CMSMS 1.0.2, HitCounter 1.0.4 installed, and a directory named HitCounter2 placed in the Modules directory. HitCounter2 contains identical files to HitCounter, but all references to HitCounter have been replaced with HitCounter2 (I did a case-sensitive find/replace, so hitcounter becomes hitcounter2, HitCounter becomes HitCounter2, etc.)
For what it's worth, an empty HitCounter2 directory doesn't break the listmodules.php page. This leads me to believe that there is some other edit that needs to happen within a file in the HitCounter2 directory.
Re: Multiple Hit Counter usages
Posted: Tue Dec 05, 2006 7:41 pm
by jmcgin51
More updates;
It's the HitCounter2.module.php file that breaks the listmodules.php page. That didn't make sense, but I noticed that no other modules in my Modules directory contained a numeric value. SO, I renamed HitCounter2.module.php to HitCounterB.module.php, and VOILA - listmodules.php is no longer broken, and my Admin styles return.

????????
However, even after doing a case-sensitive find/replace on all files, replacing all instances of HitCounter2 with HitCounterB, I still get no joy on the listmodules.php page. Only the original HitCounter is displayed. I cleared the cache, and still no luck.
Does this make sense to anyone?
Re: Multiple Hit Counter usages
Posted: Wed Dec 06, 2006 3:34 am
by jmcgin51
another development...
If I name the new HitCounter module directory "HitCounterB", it breaks listmodules.php, even if the file is named HitCounterB.module.php. If the folder is named HitCounter2, listmodules.php is ok, but if the file is named HitCounter2.module.php, it breaks.
Re: Multiple Hit Counter usages
Posted: Wed Dec 06, 2006 3:54 am
by calguy1000
Okay, it took me all of five minutes to whip this together.
It hasn't been tested (well) yet. but it does show up in the listmodules stuff. in 1.0.2 (well 1.0.x svn).
all I've done is:
a) Changed HitCounter to HitCounter2
b) changed hitcounter to hitcounter2
c) changed StringList to StringList2
[gelöscht durch Administrator]
Re: Multiple Hit Counter usages
Posted: Wed Dec 06, 2006 12:49 pm
by jmcgin51
ahhhh... I didn't know about StringList.
Thanks so much!!!!!!!
Re: Multiple Hit Counter usages
Posted: Wed Dec 06, 2006 6:25 pm
by jmcgin51
working great - thanks!!
Note to self and others who want to use this: you must leave the original HitCounter module untouched.
I tried using HitCounterMonth and HitCounterYear (without a basic HitCounter directory), and it wouldn't work. The modules would install and I could go to the HitCounterMonth or HitCounterYear admin pages, but there was nothing under "Preferences", and clicking "Preferences" didn't do anything. Once I renamed one of the modules back to "HitCounter" and made the necessary file text replacements, everything worked as desired. Very cool!