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

nested news part 2

Explorer ,
Jun 10, 2010 Jun 10, 2010

I have it kind of working but i need to do a second group for the months.

2010
      June News Item1
     June News Item2
     June News Item3
     April News Item4

I need to group so

2010
      June

        News Item1

        News Item2

        News Item3

   April

         News Item4

This is what I have so far

<cfquery name="qGetResults" datasource="mysource"> SELECT * FROM results </cfquery>

<cfdump var="#qGetResults#">

<cfoutput query="qGetResults" group="year">


#year# <br />

        <cfoutput>#MonthAsString(Month(result_date))# #title#<br /></cfoutput>


</cfoutput>

thanks.

251
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 ,
Jun 10, 2010 Jun 10, 2010
LATEST

First, put an order by clause in your query.  Otherwise the group attribute of cfoutput won't work properly.

Next, you can use the group attribute more than once on the same query.  It goes something like this.

<cfoutput query = "abc" group = "field1">

#field1#

<cfoutput group = "field2">

#field2#

<cfoutput>

#ungrouped data#

closing tags.

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