Created
March 8, 2010 07:24
-
-
Save anandkunal/324963 to your computer and use it in GitHub Desktop.
ColdFusion Tagging Library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfset tags_list = " CaMELCaSE comma, 'singlequoted' <b>bold</b> ""doublequoted"" double double this should be over the limit now " /> | |
<cfset amount = 10 /> | |
<cfset length = 20 /> | |
<pre><cfset tags_list = trim(tags_list) /> | |
<cfset tags_list = lcase(tags_list) /> | |
<cfset tags_struct = structnew() /> | |
<cfloop index="tag" list="#tags_list#" delimiters=" "> | |
<cfset tags_struct[tag] = "" /> | |
</cfloop> | |
<cfset tags_list = structkeylist(tags_struct," ") /> | |
<cfset tags_list = listsort(tags_list, "textnocase", "asc", " ") /> | |
<cfif tags_list neq ""> | |
<cfif listlen(tags_list," ") lte amount> | |
<cfset amount = listlen(tags_list," ") /> | |
</cfif> | |
<cfloop from="1" to="#amount#" index="tag"> | |
*** Perform a database insert/update here *** | |
<cfoutput>#htmleditformat(left(listgetat(tags_list,tag," "),length))#</cfoutput> | |
</cfloop> | |
<cfelse> | |
Sorry, you need to provide at least one tag | |
</cfif> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment