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

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.

Thanks this was really helpful, I got so bogged down with cflooping that I didn't think to try looking at it differently!!!

I'm tasked to work on our LDAP server. It consists of validating the user credentials by checking and matching their passwords stored in the primary Active Directory server. If the passwords are not found there, the passwords will be checked and matched in the secondary Active Directory server. In this step, we want to ensure that the passwords are encrypted and are able to be decrypted going to the secondary server. Right now, I do a research on how to encrypt an decrypt passwords. I need help please see the code

<cfset root = "DC=pa,DC=mil">
<cfset attributes = "sAMAccountName,dn,cn">
<cfset filter = "(&(sAMAccountName=#Form.username#)(objectclass=*))">
<cfset LDAP_username = "CN=DMA Apps,CN=Users,DC=pa,DC=mil">
<cfset LDAP_password = "">
<cfset LDAP_SERVER = "">
<cfset LDAP_SERVER2 = "">
<cfset LDAP_PORT = >
<cfset UserSearchFailed = 0>

<cftry>
<p><b>washington.pa.mil</b></p>
<cfldap action = "QUERY"
name = "userSearch"
attributes = "#attributes#"
start = "#root#"
scope = "SUBTREE"
server = "#LDAP_SERVER2#"
port = "#LDAP_PORT#"
filter = "#filter#" timeout="10"
username = "#LDAP_username#"
password = "#LDAP_password#">

<cfcatch type = "ANY">
<cfset UserSearchFailed = 1>
</cfcatch>
</cftry>

<cfif UserSearchFailed EQ 1>
<p><b>comet.pa.mil</b></p>
<cfset UserSearchFailed = 0>
<cftry>
<cfldap action = "QUERY"
name = "userSearch"
attributes = "#attributes#"
start = "#root#"
scope = "SUBTREE"
server = "#LDAP_SERVER#"
port = "#LDAP_PORT#"
filter = "#filter#"
username = "#LDAP_username#" timeout="10"
password = "#LDAP_password#">
<cfcatch type = "ANY">
<cfset UserSearchFailed = 1>
</cfcatch>
</cftry>
</cfif>

<!------------ If error or no match for username ----------------->
<cfif IsDefined("userSearch.RecordCount") AND (NOT userSearch.recordcount)>
<cfset UserSearchFailed = 1>
</cfif>
<!--- <p><b>TESTING....</b></p> --->

<!--- pass the user's DN and password to see if the user authenticates --->
<cftry>
<p><b>washington.pa.mil</b></p>
<cfset UserSearchFailed = 0>
<cfldap action = "QUERY"
name = "auth"
attributes = "#attributes#"
start = "#root#"
scope = "SUBTREE"
filter = "#filter#"
server = "#LDAP_SERVER2#"
port = "#LDAP_PORT#"
username = "#userSearch.dn#"
password = "#Form.Password#">

<cfcatch type = "ANY">
<cfset UserSearchFailed = 1>
</cfcatch>
</cftry>

<cfif UserSearchFailed EQ 1>
<p><b>comet.pa.mil</b></p>
<cfset UserSearchFailed = 0>
<cftry>
<cfldap action = "QUERY"
name = "auth"
attributes = "#attributes#"
start = "#root#"
scope = "SUBTREE"
filter = "#filter#"
server = "#LDAP_SERVER#"
port = "#LDAP_PORT#"
username = "#userSearch.dn#"
password = "#Form.Password#">

<cfcatch type = "ANY">
<cfset UserSearchFailed = 1>
</cfcatch>
</cftry>
</cfif>

<!--- If ldap query returned the user is not valid --->
<cfif (NOT IsDefined("auth")) OR auth.RecordCount LTE 0>
<cfset UserSearchFailed = 1>
</cfif>

<cftry>
<cfset UserSearchFailed = 0>
<cfldap action = "QUERY"
name = "groupSearch"
attributes = "cn,member"
start = "#root#"
scope = "SUBTREE"
server = "#LDAP_SERVER2#"
port="#Variables.LDAP_PORT#"
filter="(&(objectclass=*)(cn=earlybird-users-dl))"
username = "#LDAP_username#"
password = "#LDAP_password#">
<cfcatch type="any">
<cfset UserSearchFailed = 1>
</cfcatch>
</cftry>

<cfif UserSearchFailed EQ 1>
<cftry>
<cfset UserSearchFailed = 0>
<cfldap action = "QUERY"
name = "groupSearch"
attributes = "cn,member"
start = "#root#"
scope = "SUBTREE"
server = "#LDAP_SERVER#"
port="#Variables.LDAP_PORT#"
filter="(&(objectclass=*)(cn=earlybird-users-dl))"
username = "#LDAP_username#"
password = "#LDAP_password#">
<cfcatch type="any">
<cfset UserSearchFailed = 1>
</cfcatch>
</cftry>
</cfif>

<cfif (IsDefined("userSearch.cn") AND IsDefined("groupSearch.member")) AND (NOT FindNoCase(userSearch.cn, groupSearch.member))>
<cfset UserSearchFailed = 1>
</cfif>

Tacking onto a question that's over 2 years old, (and is totally unrelated to what you're asking!), is probably not the best way to get an answer ;) Open a new question ..

This article has been dead for over six months. Start a new discussion instead.