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

hi wanna display as 3 in table row

Explorer ,
Feb 04, 2009 Feb 04, 2009

Copy link to clipboard

Copied

Hi, Still in categories and subcategories: my below component is displaying the code as tree menu:

<cfcomponent name="Categories">
<cffunction name="getCats">
<!--- Parent ID --->
<cfargument name="parent" type="numeric">
<!--- Query for Children of Parent --->
<cfquery name="cats" datasource="#request.dsn#">
SELECT * FROM
categories
WHERE parentid = <cfqueryparam cfsqltype="cf_sql_numeric" value="#arguments.parent#">
</cfquery>
<!--- Create Output --->
<cfif cats.recordcount GT 0>
<cfset output = "<ul>">
<!--- Loop over all items --->
<cfloop query="cats">
<cfset output = "#output# <li><a href='a.cfm?id=#cats.catID#'>#cats.category#</a>">
<!--- Check Children of this item --->
<cfif cats.recordcount GT 0>
<cfset output = "#output# #CreateObject('component', 'wrap').getCats(cats.catid)#">
</cfif>
<cfset output = "#output#</li>">
</cfloop>
<cfset output = "#output#</ul>">
<cfreturn output />
</cfif>
</cffunction>
</cfcomponent>

And what i was tryng is that for every category a <td> should be created and then i should add something like <cfif query.currentRow MOD 3>

it should move to the next <td> TAG.

Till Here but the problem is i am trying to doin may be say stupid way.

under category in one <TD> if that category have subcats. then it should display them as ul and li. and like this:

i created a table generation but getting into problems while plugging it in the cfc:

here is of my auto table generation:

<table align="center" width="100%" border="0">
<cfif variables.newrow EQ true>
<tr>
</cfif>
<td>My CFC Code Goes Here</td>
<cfif query.currentRow MOD 4 EQ 0>
</tr>
<cfset variables.newrow = true>
<cfelse>
<cfset variables.newrow = false>
</cfif>
<tr>
</table>
</div>
</cfoutput>
TOPICS
Advanced techniques

Views

297

Translate

Translate

Report

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 ,
Feb 05, 2009 Feb 05, 2009

Copy link to clipboard

Copied

LATEST
It would be much simpler if you got all your data before you attempt to display it. Plus it appears that you can get all the data you need with a single query.

Votes

Translate

Translate

Report

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
Documentation