This post is more than 2 years old.
Based on my post from yesterday, here is my 5 minute 'quick stat' solution to the puzzle. Note, this is not thread safe and it will quickly destroy my server (most likely), but it works!
I added this to Application.cfm, at the bottom, before my last cfsetting.
<cffunction name="getCurrentURL" output="No" access="public" returnType="string"> <cfset var theURL = getPageContext().getRequest().GetRequestUrl().toString()> <cfif len( CGI.query_string )><cfset theURL = theURL & "?" & CGI.query_string></cfif> <cfreturn theURL> </cffunction> <cfset s = structGet("application.data")> <cfset p = getCurrentURL()> <cfif not structKeyExists(s, p)> <cfset s[p] = 0> </cfif> <cfset s[p]++>
The UDF comes from CFLib of course. It handles both query string and path_info CGI variables so it works well on the blog.
To display it, I wrote this script:
<cfset sorted = structSort(application.data,"numeric","desc")> <table width="100%" border="1" cellpadding="5"> <tr> <th>Page</th> <th>Count</th> </tr> <cfloop index="a" array="#sorted#"> <cfoutput> <tr> <td>#a#</td> <td>#numberFormat(application.data[a])#</td> </tr> </cfoutput> </cfloop> </table>
Nothing too complex here outside of the cool structSort function which works perfectly for this example. If you are bored, you can see this in action here.