Advertisement
snarfblat

createQueryString for MuraCMS

Apr 26th, 2014
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!--- Place this in your ContentRenderer.cfc --->
  2. <!--- Pass in a comma-delimited list of $.event() variables and the function loops over them, returning non-null
  3. variables paired with their values --->
  4.  
  5. <cffunction name="createQueryString">
  6.     <cfargument name="items" list="true">
  7.  
  8.     <cfset var count = "">
  9.     <cfset var queryList = "">
  10.     <cfset var qStringItem = "">
  11.     <cfset var item = "">
  12.     <cfset var itemValue = "">
  13.  
  14.     <cfloop index="count" list="#argument.items#">
  15.         <cfset item = $.event(count)>
  16.         <cfif Len(item) gt 0>
  17.             <cfset itemValue = Evaluate($.event(count))>
  18.             <cfset qStringItem = "#item#=#itemValue#">
  19.             <cfset queryList = ListAppend(queryList, qStringItem, "&")>
  20.         </cfif>
  21.     </cfloop>
  22.  
  23.     <cfreturn queryList>
  24. </cffunction>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement