Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

where would I put this code???

Posted on 2011-05-03
7
Medium Priority
?
272 Views
Last Modified: 2012-08-13
Hi,

Oh, I have this piece of code that I know it would display 5 names per row. but
I am not sure where to put it here.
so, since my brain is blinking Maybe someone somewhere somehow can help me.
thank you,
lulu
This is the code I want to <br> after 5 names
<cfif currentRow mod 5 eq 0>

<CFQUERY DATASOURCE="xxx" NAME="DispMainMenu" cachedwithin="#createTimeSpan(0,0,0,-1)#">
 SELECT MainMenuName, MenuID, MainMenuURL, RelIDMainMenu, MainMenuStatus
   FROM MainMenu where MainMenuStatus = 'A' 
 ORDER BY MainMenuOrderBy
</CFQUERY>

<CFQUERY DATASOURCE="xxx" NAME="DispSubMenu" cachedwithin="#createTimeSpan(0,0,0,-1)#">
SELECT MainMenu.MenuID,SubMenuName,SubMenuURL,DivID 
  FROM MainMenu left join SubMenu on  MainMenu.MenuID = SubMenu.MenuID
where SubMenuStatus = 'A'
order by SubMenu.SubMenuName
</CFQUERY>


<tr>
<td colspan="2" ><div id="dolphincontainer">

<div id="dolphinnav">
<ul>
<cfloop query = "DispMainMenu"> 
  <li><cfoutput><a href="#MainMenuURL#" rel="#RelIDMainMenu#"><span>#MainMenuName#</span></a></cfoutput></li>
</cfloop>
</ul>
</div>


<div id="dolphin_inner">
<cfloop query = "DispSubMenu">
<div id="<cfoutput>#DispSubMenu.DivID#</cfoutput>" class="innercontent"> 
<table>
 <tr>
   <td>&nbsp;</td>
 </tr>
 <tr>
  <cfif DispMainMenu.MenuID neq "1">
    <td style="border-right: 1px solid #adc0d1;border-top: 1px solid #adc0d1;border-left:1px solid #adc0d1;border-bottom: 1px solid #adc0d1;width:150px;height:30px;" background="images/bg.gif">
       <a href="#" style="color: #000000" onMouseOver="this.style.color='#93b38e'" onMouseOut="this.style.color='#000000'"><cfoutput>#DispSubMenu.SubMenuName#</cfoutput></a>
    </td>
  </cfif>
 </tr>
</table>
</div>
</cfloop>


</td>
</tr>

Open in new window

0
Comment
Question by:lulu50
  • 3
  • 3
7 Comments
 
LVL 6

Expert Comment

by:cfEngineers
ID: 35516390
look at the previous post, i gave you a drop-in solution that will loop every 5 rows and give you another <tr>
0
 
LVL 6

Expert Comment

by:cfEngineers
ID: 35516405

<table>
	<cfloop query="DispSubMenu">
		<cfif DispSubMenu.currentrow mod 5 or DispSubMenu.currentrow eq 1><tr></cfif>
        	<td style="border-right: 1px solid #adc0d1;border-top: 1px solid #adc0d1;border-left:1px solid #adc0d1;border-bottom: 1px solid #adc0d1;width:150px;height:30px;" background="images/bg.gif">
            	<a href="#" style="color: #000000" onMouseOver="this.style.color='#93b38e'" onMouseOut="this.style.color='#000000'"><cfoutput>#DispSubMenu.SubMenuName#</cfoutput></a>
			</td>	
		<cfif currentrow mod 5 or DispSubMenu.currentrow eq DispSubMenu.recordcount></tr></cfif>
    </cfloop>
</table>

Open in new window

0
 

Author Comment

by:lulu50
ID: 35516459
cfEngineers:

I tried it but it displayed all my records name horizontal like this.

Antiques  
Any Real Estate  
Building Lot  
Co-op Unit  
Condominium Unit  
Duplex  
Farm  
Housing swap  
Mobile/Manufactured Home  
Multi-Family Home  
Offie/Commercial  
Parking/Storage  
Raw Land  
Rooms/Shared  
Row House  
Single Family Home  
Sublets/Temporary  
Townhouse/Townhome  
Vacation Rentals  
Vacation swap  

but what I want is something like this.

Antiques   Any Real Estate  Building Lot  Co-op Unit  Condominium Unit  
Duplex  Farm  Housing swap  Mobile/Manufactured Home  Multi-Family Home  
Offie/Commercial  Parking/Storage  Raw Land  Rooms/Shared  Row House  
Single Family Home  Sublets/Temporary  Townhouse/Townhome  Vacation Rentals  Vacation swap  
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 

Author Comment

by:lulu50
ID: 35516468
<tr>
<td colspan="2" >
<div id="dolphincontainer">
<div id="dolphinnav">
<ul>
<cfloop query = "DispMainMenu">
  <li><cfoutput><a href="#MainMenuURL#" rel="#RelIDMainMenu#"><span>#MainMenuName#</span></a></cfoutput></li>
</cfloop>
</ul>
</div>
<cfloop query = "DispMainMenu">
<CFQUERY DATASOURCE="xx" NAME="DispSubMenu" cachedwithin="#createTimeSpan(0,0,0,-1)#">
 SELECT MainMenu.MenuID,SubMenuName,SubMenuURL,DivID
   FROM MainMenu left join SubMenu on  MainMenu.MenuID = SubMenu.MenuID
 where SubMenuStatus = 'A'
 and   MainMenu.MenuID = #val(DispMainMenu.menuID)#
 order by SubMenu.SubMenuName
</CFQUERY>

<div id="Div1">
   <div id="<cfoutput>#RelIDMainMenu#</cfoutput>" class="innercontent">
    <table>
    <cfloop query="DispSubMenu">
            <cfif DispSubMenu.currentrow mod 5 or DispSubMenu.currentrow eq 1><tr></cfif>
              <td style="border-right: 1px solid #adc0d1;border-top: 1px solid #adc0d1;border-left:1px solid #adc0d1;border-bottom: 1px solid #adc0d1;width:150px;height:30px;" background="images/bg.gif">
                  <a href="#" style="color: #000000" onMouseOver="this.style.color='#93b38e'" onMouseOut="this.style.color='#000000'"><cfoutput>#DispSubMenu.SubMenuName#</cfoutput></a>
                  </td>      
            <cfif currentrow mod 5 or DispSubMenu.currentrow eq DispSubMenu.recordcount></tr></cfif>
    </cfloop>
    </table>
  </div>
</div>
</cfloop>
</td>
</tr>
0
 
LVL 6

Expert Comment

by:cfEngineers
ID: 35516501
OK I am heading home, I will take a look at it later to see if I can conjure up something.
0
 
LVL 53

Accepted Solution

by:
_agx_ earned 2000 total points
ID: 35516900
If you're using a <table> you need to create a new table row ie <tr>, not an html <br>.

Simple Example:
<!---- using border="1" so you can see there are 5 cells per row
<table border="1">
<tr>
	<cfloop query="DispSubMenu">
        	<td><cfoutput>#DispSubMenu.SubMenuName#</cfoutput></a></td>	

		<!--- start a new *table* row every 5th query row --->
		<cfif (currentrow mod 5) eq 0>
		     </tr><tr>
		</cfif>
    </cfloop>
</tr>		
</table>

Open in new window

0
 

Author Closing Comment

by:lulu50
ID: 35517006
Thank you
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question