RE: Page Counter
Hi Brendan Thank you very much :))) its working good :) um.. but i wonder why have these 3 lines below; 1. cfif attributes.result is not "" 2. cfset "caller.#attributes.result#"=#currentvalue# 3. /cfif Thank you very much regards, phim -Original Message- From: brendan avery [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 6:32 PM To: CF-Talk Subject: Re: Page Counter !--- SIMPLECOUNTER.CFM (may be renamed to whatever you want) by brendan avery - [EMAIL PROTECTED] - http://www.brendanavery.com description a simple hit counter example. use only in the context of cfmodule or as a custom-tag. requirements CFFILE must be enabled. attributes "filename" - string - required - this is the filename to use for the counter data. this filename should be the name of the file. if the full path is not used, the file will be read/written in the directory of the base template. to have different counters for different pages, just use different filenames. examples usage: cf_simplecounter filename="mycounter.txt" cf_simplecounter filename="mycounter2.txt" cf_simplecounter filename="subdir\mycounter.txt" cf_simplecounter filename="C:\mysite\mycounter.txt" cf_simplecounter filename="#expandpath('mycounter.txt')#" "result" - string - optional - this is the name of a variable to return which will have a value equal to the NEW number of hits in the counter, or, in the event of an error, the value 0. example usage: cf_simplecounter filename="C:\mysite\counter.txt" result="mynumber" total hits: cfoutput#mynumber#/cfoutput --- cfparam name="attributes.filename" cfparam name="attributes.result" default="" cfset attributes.filename=#ExpandPath(attributes.filename)# cftry cffile action="READ" file="#attributes.filename#" variable="currentvalue" cfset currentvalue=#Int(Trim(currentvalue))# cfcatch cfset currentvalue=0 /cfcatch /cftry cfset currentvalue=#currentvalue#+1 cftry cffile action="WRITE" file="#attributes.filename#" output="#currentvalue#" addnewline="No" cfcatch cfset currentvalue=0 /cfcatch /cftry cfif attributes.result is not "" cfset "caller.#attributes.result#"=#currentvalue# /cfif ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Page Counter
!--- SIMPLECOUNTER.CFM (may be renamed to whatever you want) by brendan avery - [EMAIL PROTECTED] - http://www.brendanavery.com description a simple hit counter example. use only in the context of cfmodule or as a custom-tag. requirements CFFILE must be enabled. attributes "filename" - string - required - this is the filename to use for the counter data. this filename should be the name of the file. if the full path is not used, the file will be read/written in the directory of the base template. to have different counters for different pages, just use different filenames. examples usage: cf_simplecounter filename="mycounter.txt" cf_simplecounter filename="mycounter2.txt" cf_simplecounter filename="subdir\mycounter.txt" cf_simplecounter filename="C:\mysite\mycounter.txt" cf_simplecounter filename="#expandpath('mycounter.txt')#" "result" - string - optional - this is the name of a variable to return which will have a value equal to the NEW number of hits in the counter, or, in the event of an error, the value 0. example usage: cf_simplecounter filename="C:\mysite\counter.txt" result="mynumber" total hits: cfoutput#mynumber#/cfoutput --- cfparam name="attributes.filename" cfparam name="attributes.result" default="" cfset attributes.filename=#ExpandPath(attributes.filename)# cftry cffile action="READ" file="#attributes.filename#" variable="currentvalue" cfset currentvalue=#Int(Trim(currentvalue))# cfcatch cfset currentvalue=0 /cfcatch /cftry cfset currentvalue=#currentvalue#+1 cftry cffile action="WRITE" file="#attributes.filename#" output="#currentvalue#" addnewline="No" cfcatch cfset currentvalue=0 /cfcatch /cftry cfif attributes.result is not "" cfset "caller.#attributes.result#"=#currentvalue# /cfif ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Page Counter
Phim, Do you need to know hits, and not user sessions, per page visit? I needed this for a past project and used a simple database driven custom tag. If you need this email me off list and I can send it to you. Tony Gruen [EMAIL PROTECTED] -Original Message- From: Phim [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 1:54 AM To: CF-Talk Subject: Page Counter Hi Everyone Please give me suggestion about good page counter , I will like to create page counter for 1st level page ,2nd level page and 3rd level page. Such as I have Member page, Owner page and Admin page. Everypage counter run one their own. This is about session ? Thank you very much Regards, Phim. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists