'*******************************************************************
'****** ASP Based tag cloud ****************************************
'****** Created by Paul Guise - paulguise@gmail.com - 7-25-06 ******
'*******************************************************************
Function tagCloud(theTable,sqlCond)
Dim aDigits, tempTagHolder, biggestNum
OpenDB()
strSql = "SELECT Tags FROM "&theTable&" WHERE Status=1"
Set objRs = objConn.Execute (strSql)
While Not objRs.EOF
'dump all of the tags into one variable
tempTagHolder = tempTagHolder & objRs("Tags") & " "
objRs.MoveNext
Wend
objRs.Close()
'make it pretty
tempTagHolder = Trim(Replace(tempTagHolder," "," "))
tempTagHolder = lcase(tempTagHolder)
'split the veriable into an array
aDigits = split(tempTagHolder, " ")
'sort the tags alphabetically, will return the variable given
SingleSorter aDigits
'testing: display the alphabetized list
'Response.Write(join(aDigits," ") & "
")
'get the tag with the highest mention
biggestNum = 0
lastTag = aDigits(0)
For i=0 to UBound(aDigits)
If lastTag = aDigits(i) Then
tagCount = tagCount+1
Else
If tagCount >= biggestNum Then
biggestNum = tagCount
End If
tagCount = 1
End If
lastTag = aDigits(i)
If i = UBound(aDigits) Then
If tagCount >= biggestNum Then
biggestNum = tagCount
End If
End If
Next
'loop through the array and output the tags
Dim lastTag, tagCount, i, newTag, loopHolder, tempNewTag
lastTag = aDigits(0)
tagCount=0
For i=0 to UBound(aDigits)
If lastTag = aDigits(i) Then
tagCount = tagCount+1
Else
Response.Write (""&renderTag(lastTag,tagCount,biggestNum)&" ")
tagCount = 1
End If
lastTag = aDigits(i)
If i = UBound(aDigits) Then
Response.Write (""&renderTag(lastTag,tagCount,biggestNum)&" ")
End If
Next
End Function
Function renderTag(tagName,tagCount,biggestNum)
Dim tempContent
If tagCount < (biggestNum*0.20) Then
'tempContent="