-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathfeeds_list.cfm
75 lines (65 loc) · 1.78 KB
/
feeds_list.cfm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!---
Name : feeds_list.cfm
Author : Raymond Camden
Created : July 29, 2007
Last Updated : July 29, 2007
History :
Purpose : Handles showing a section of feeds.
--->
<cfparam name="url.r" default="a-e">
<cfif not listLen(url.r,"-") is 2>
<cfset url.r = "a-e">
</cfif>
<cfset first = listFirst(url.r,"-")>
<cfset last = listLast(url.r,"-")>
<cfset key = "#first#_#last#">
<cfset content = cacheGet("feedlist_#key#")>
<cfif isNull(content) or structKeyExists(url,"clearcache")>
<cfsavecontent variable="content">
<cfset blogs = application.entries.getFeeds()>
<cfquery name="blogs" dbtype="query">
select *
from blogs
where
<cfloop index="x" from="#asc(first)#" to="#asc(last)#">
lower(name) like '#lcase(chr(x))#%'
<cfif x is not asc(last)>
or
</cfif>
</cfloop>
<cfif first is "a">
or lower(name) not like '[a-z]%'
</cfif>
</cfquery>
<div id="feedList">
<cfif blogs.recordCount gte 1>
<cfoutput query="blogs">
<cfset stats = application.entries.getFeedStats(id)>
<p>
<a href="#blogs.url#">#name#</a><br />
#description#
</p>
<p>
Total entries aggregated: <cfif stats.totalentries is "">0<cfelse>#numberFormat(stats.totalentries)#</cfif><br />
Total number of clicks: <cfif stats.totalclicks is "">0<cfelse>#numberFormat(stats.totalclicks)#</cfif><br />
Average clicks per entry:
<cfif stats.totalentries neq "" and stats.totalclicks neq "" and stats.totalentries gt 0>
<cfset average = stats.totalclicks/stats.totalentries>
#numberFormat(average, "9999.99")#
<cfelse>
0
</cfif>
</p>
</cfoutput>
<cfelse>
<cfoutput>
<p>
Sorry, but I ain't got nothing to show...
</p>
</cfoutput>
</div>
</cfif>
</cfsavecontent>
<cfset cachePut("feedlist_#key#", content)>
</cfif>
<cfoutput>#content#</cfoutput>