Neat Trick With ValueList()
Posted September 6, 2006 at 6:06 PM
This is just a quick little trick for outputting a list of items with proper spacing. You can use ColdFusion ValueList() using a delimiter that has both a comma AND a space in it: ", ". While this is not really a valid delimiter, which is defined as one character, the ValueList() method will still use both characters when creating the delimited list. Now, you have a nicely spaced list.
Launch code in new window » Download code as text file »
- <cfquery name="qTags" datasource="...">
- SELECT
- name
- FROM
- tag
- ORDER BY
- name ASC
- </cfquery>
-
- <!--- Output nicely formatted tag list. --->
- Tags: #ValueList( qTags.name, ", " )#
Download Code Snippet ZIP File
Post Comment | Ask Ben | Permalink | Other Searches | Print Page
Newer Post
XStandard Support Weighs In On The Color Coding Issue
Older Post
Finding Values In A ColdFusion Array Using Java - And Other Cool Stuff
Reader Comments
I love CF's list functions. :)
Of course, for the other sort of lists, you can also do this:
<ul><li>#ValueList( qTags.name, "</li><li>" )#</li></ul>
which has come in handy for me on a couple of occasions.




