DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   ColdFusion (http://www.daniweb.com/forums/forum19.html)
-   -   cfloops (http://www.daniweb.com/forums/thread114123.html)

mollypepperpot Mar 15th, 2008 6:40 pm
cfloops
 
I'm trying to make a list of sub titles that links to mid topic jumps on another page. As the sub titlles are the same for each main title and the midtopic jumps increment numerically- I thought I could use cfloop - but I can't get it to work - either my titles all have to be the same or my links all have to be the same.... can anyone help??
I tried using nested loops but that made it worse as the inner loop had to loop through before the outer loop ... hope that makes sense!!! Can someone help me??

As you may have guessed - I'm a noobie so I would be grateful for any suggestions

cmhampton Mar 18th, 2008 2:31 pm
Re: cfloops
 
Are you outputting from a query?

If so you can use the group attribute of the cfoutput tag. Here's an example:

<cfoutput query="queryname" group="title">
  #Title#
  <cfoutput>
    #SubTitle#<br />
  </cfoutput>
</cfoutput>

This would ouput the following:

Title1
Subtitle1
Subtitle2
Subtitle3
Title2
Subtitle1
Subtitle2
Title3
Subtitle1

Post some of your code and I'll have a look at it.

mollypepperpot Mar 18th, 2008 6:03 pm
Re: cfloops
 
Thanks this was really helpful, I got so bogged down with cflooping that I didn't think to try looking at it differently!!!

cmhampton Mar 18th, 2008 6:37 pm
Re: cfloops
 
Glad to help. Let me know if you have any other questions.


All times are GMT -4. The time now is 3:44 pm.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC