Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

dynamicly nestled cfloops

New Here ,
Jan 19, 2009 Jan 19, 2009
Hello Every one,

I wondered if it is possible to dynamically nestle loops.

If i get a variable equal to 2 i would like to do something like this:

<cfloop query 1>
output 1
<cfloop query 2>
output 2
</cfloop>
</cfloop>

If i get a variable equal to3 i would like to do something like this:

<cfloop query 1>
output 1
<cfloop query 2>
output 2
<cfloop query 3>
output 3
</cfloop>
</cfloop>
</cfloop>

I have no idea how to go about to do this.
Thanks for any help!

Yann.
TOPICS
Getting started
586
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jan 19, 2009 Jan 19, 2009
I thought the triple post was some sort of dynamic nested loop.

Regarding your question, the only thing I can think of is to dynamically write the code as text, write the text to a file, then cfinclude the file. However, that depends on the complexity of what you want to output.
Translate
New Here ,
Jan 19, 2009 Jan 19, 2009
Apology for triple upload, due to bad connection. Wanted to delete other 2 but couldn't find functionality to do so.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 19, 2009 Jan 19, 2009
I thought the triple post was some sort of dynamic nested loop.

Regarding your question, the only thing I can think of is to dynamically write the code as text, write the text to a file, then cfinclude the file. However, that depends on the complexity of what you want to output.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 19, 2009 Jan 19, 2009
LATEST
Thank you Dan!

Indeed, that's how I finally built it. I just thought their might be a cleaner way to do it.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources