misc
misc
Prefix | misc |
Library path | /tags/misc |
CFImport |
|
<misc:cacheControl ...>
Attributes
Name | Type | Required | Default | Options | Description |
browserSeconds | string | No | -1 | | |
proxySeconds | string | No | -1 | | |
<misc:diff ...>
Loops over differences between one string (or array) and
another. If strings are passed in they are stripped of HTML tags and compared
word by word. After the tags has finished executing, the complete array of diffs
is returned.
Attributes
Name | Type | Required | Default | Options | Description |
old | string | No | | | The old value. This should be a string (will be stripped of HTML tags and compared by word) |
new | string | No | | | The new value. This should be in the same format as old. |
diff | string | No | diff | | The variable that the result is stored in. During execution this variable contains individual diff structs: { diff="+|-|=", oldindex, oldvalue, newindex, newvalue }. After execution this variable contains an array of all diffs. Defaults to "diff" |
<misc:map ...>
Loops over a set of values and gathers return values from enclosed code. These new values are collected into an output set.
<misc:map values="#url#" resulttype="querynew('key,value')">
<cfset sendback[1].key = index />
<cfset sendback[1].value = value />
</misc:map>
<cfdump var="#result#" />
<misc:map values="#application.stCOAPI#" index="thistype" value="metadata" result="stWebskins" resulttype="struct" sendback="typesendback">
<misc:map values="#metadata.qWebskins#" index="currentrow" value="webskin" result="typesendback.#thistype#" resulttype="struct" sendback="webskinsendback">
<cfif len(webskin.methodname) and webskin.methodname neq "deniedaccess">
<cfset webskinsendback[webskin.methodname] = webskin.path />
</cfif>
</misc:map>
</misc:map>
<cfdump var="#stWebskins#" />
Attributes
Name | Type | Required | Default | Options | Description |
values1 | string | No | #attributes.values# | | valuesN can be used to input any number of input sets for processing |
values1 | string | No | | | The set of source values. Can be a struct, array, list, or query. |
index | string | No | index | | The variable that will contain the index of the source item. For structs this is the key. |
value | string | No | value | | The variable that will contain the value of the source item. For queries this is a struct of the column values. If this value is a non-simple value (e.g. struct) editing it will alter the source set. Defaults to "value" |
sendback | string | No | sendback | | The variable that enclosed code will add output items to. The type of this variable depends on the output set type: For structs this is a struct which gets merged into the output set. For arrays this is an array that gets appended to the output set. For lists this is a string that gets appended to the output list. For queries this is an array of row structs (containing one empty struct by default), each of which is appended to the output query. If this variable is "empty" (e.g. empty struct) no items are added to the output set. Defaults to "sendback" |
resulttype | string | No | Same as values | struct, array, list, querynew('col1,col2') | The output set type. Defaults to the same type as the source set. |
result | string | No | result | | The variable the output set is stored in once this tag has finished execution. Defaults to "result" |
delimiters | list | No | , | | Only applies for resulttype="list". Specifies an alternate delimiter. |
delimitersin | string | No | #attributes.delimiters# | | Only applies when values is a list. Specifies an alternate delimiter for the input list only. |
delimitersout | list | No | #attributes.delimiters# | | Only applies for resulttype="list". Specifies an alternate delimiter for the output list only. |
<misc:sort ...>
This tag provides "anonymous comparison function" sorting
functionality using the quick sort algorithm. It is useful for situations where
the sort definition is too complex for the native functions. The quick
sort algorithm has been abstracted so that the comparisons between items can be
performed by the code enclosed by the tag. That code is executed for each
comparison. Note: This tag DOES alter array type source sets.
<cfset values = arraynew(1) />
<cfset values[1] = structnew() />
<cfset values[1].a = 10 />
<cfset values[1].b = 30 />
<cfset values[2] = structnew() />
<cfset values[2].a = 25 />
<cfset values[2].b = 5 />
<cfset values[3] = structnew() />
<cfset values[3].a = 15 />
<cfset values[3].b = 20 />
<misc:sort values="#values#">
<cfset sendback = max(value2.a,value2.b) - max(value1.a,value1.b) />
</misc:sort>
<cfdump var="#result#" />
Attributes
Name | Type | Required | Default | Options | Description |
values | string | No | | | The source set. Can be a list, array, or struct. |
value1 | string | No | value1 | | The variable that will contain the first value to be compared for an iteration. Defaults to "value1" |
value2 | string | No | value2 | | The variable that will contain the second value to be compared for an iteration. Defaults to "value2" |
sendback | string | No | sendback | | The variable that will contain the result of the comparison. Should be set to 0 for "equal" values, less than 0 if the first value is "less" than the second, and more than 0 if the first value is "more" than the second. Defaults to "sendback" |
result | string | No | result | | The result of the sort. For lists and arrays this is the sorted set. For structs this is an ordered list of keys. |