Yesterday I posted a question on how to loop through the results of a custom tag, maybe I should have been a bit more precice in the overall requirement, and in fact how I solved it (not nicely hence the post).

Lets say you are abstracting some functionality in your application, lets say a list of users, that you want your design department to be able to style and do what they will without directly using coldfusion.

Lets look at some code first:

The first line imports the taglib that we are using, then you can see that I am wrapping a table row with the cms:userlist tag.

A designer would then decide which column they want to ouptut by adding these tags. Why would one one to do that you may ask? Why not just CF? What happens if they write the wrong column and you are in a live server? Also they (a designer, or html'er) would have to write the following (perhaps):

#username#

Not as nice as above, especially lets say if you have a WYSIWYG editor in your CMS right?

The solution I come up with was basically, in the first template you have the import for the prefix cms and anything inside a loop has a different prefix, that on first pass CF would ignore:

Now we have a fragment that on the ThisTag.ExecutionMode = "end" we can grab using the ThisTag.generatedContent, create a file out of, and then loop over the records and include it. The new file you create from the contents inside the loop you append the right taglib so the new file contains:

inside the userlist ThisTag.executionMode = "end" action you would now have:

" & ThisTag.generatedContent>

So the fragment you are calling is actually included, all the output from it is grabbed and then displayed. The column tag would then have some checks like:

>

Therein lies the rub, you would have to (in this loop situation) set a counter each time for what row you are on and pass that to the column tag somehow. Hence my question...