Multiple Hit Counter usages

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Multiple Hit Counter usages

Post 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?
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Multiple Hit Counter usages

Post 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...
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Multiple Hit Counter usages

Post 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...
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Multiple Hit Counter usages

Post by calguy1000 »

you also have to change the HitCounter.module.php to HitCounter2.module.php
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Multiple Hit Counter usages

Post 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
Last edited by jmcgin51 on Tue Dec 05, 2006 4:26 pm, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Multiple Hit Counter usages

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Multiple Hit Counter usages

Post 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.
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Multiple Hit Counter usages

Post 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?
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Multiple Hit Counter usages

Post 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.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Multiple Hit Counter usages

Post 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]
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Multiple Hit Counter usages

Post by jmcgin51 »

ahhhh...  I didn't know about StringList.

Thanks so much!!!!!!!
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Multiple Hit Counter usages

Post 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!
Last edited by jmcgin51 on Wed Dec 06, 2006 7:39 pm, edited 1 time in total.
Post Reply

Return to “CMSMS Core”