• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 359
  • Last Modified:

Display Menu

Hi,

Something is wrong with my code. it only display the first tab of my main menu.
I have main menu and submenu that I am trying to display.
Please, tell me what I am doing wrong.  I have to use an array do split the submenu.

here is what I have so far and it only display one tab ("home")
the main tab list:
Home
   SubMenufor home
Community
     SubMenufor Community
ForSale
     SubMenufor ForSale
Housing
     SubMenufor Housing
Jobs
     SubMenufor Jobs
Services
     SubMenufor Services



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

<CFQUERY 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>



<cfset i="1" />
<cfset ListSubMenuArray = arraynew(1)> 
<cfloop query="DispSubMenu">
<cfset ListSubMenuArray[1]="#DispSubMenu.MenuID#" />
<cfset ListSubMenuArray[2]="#DispSubMenu.SubMenuName#" />
<cfset ListSubMenuArray[3]="#DispSubMenu.SubMenuURL#" />
<cfset ListSubMenuArray[4]="#DispSubMenu.DivID#" />
</cfloop>
<cfset i= i+1> 



<tr>
<td colspan="2" >
<div id="dolphincontainer">
<cfif isDefined("DispMainMenu") and isDefined("DispSubMenu")>
<cfloop query = "DispMainMenu"> 
<div id="dolphinnav">
<ul>
<li><cfoutput><a href="#MainMenuURL#" rel="#RelIDMainMenu#"><span>#MainMenuName#</span></a>
</cfoutput></li>
</ul>
</div>
<div id="dolphin_inner">
<cfloop index="i" from="1" to="#arrayLen(ListSubMenuArray)#">
 
<cfif #DispMainMenu.MenuID# is ListSubMenuArray[i][1]>
<div id="#ListSubMenuArray[i][4]#" class="innercontent"> 
<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="#ListSubMenuArray[i][3]#" style="color: #000000" 
onMouseOver="this.style.color='#93b38e'" onMouseOut="this.style.color='#000000'">
<cfoutput>#ListSubMenuArray[i][2]#</cfoutput></a>

<cfif currentRow mod 5 eq 0>
</br>
</cfif>


</td>
</div>
</cfif>
</cfloop>  
</div>
</cfloop>   
</cfif>
</div>
</td> 
</tr>

Open in new window

0
lulu50
Asked:
lulu50
  • 13
  • 10
  • 6
1 Solution
 
gdemariaCommented:
You have defined your array to be one dimensional and populated positions 1..4 of that one dimension here..

<cfset ListSubMenuArray = arraynew(1)>
<cfloop query="DispSubMenu">
<cfset ListSubMenuArray[1]="#DispSubMenu.MenuID#" />
<cfset ListSubMenuArray[2]="#DispSubMenu.SubMenuName#" />
<cfset ListSubMenuArray[3]="#DispSubMenu.SubMenuURL#" />
<cfset ListSubMenuArray[4]="#DispSubMenu.DivID#" />
</cfloop>


Then here, you are attempting to access TWO dimensions of the array, I don't see where the second dimension came from...



<cfif #DispMainMenu.MenuID# is ListSubMenuArray[ii][1]>  <=====
.....
<cfoutput>#ListSubMenuArray[ii][2]#     <============


It seems like a 2 dimensional array is not the best way to do this.   There are two clearer options IMO...

1)  You can simply use the query, I don't see a benefit to converting it to an array (at least not in the code posted)

 2)  If you want to convert it to an array, it should be an array of structures, not a two dimensional array.  It is much easier to refer to an element as

  #ListSubMenuArray[ii].SubMenuName#

Than...

  #ListSubMenuArray[ii].[3]#

Right?



PS.  I converted the [ i ]  to   [ii]  because EE thinks its an italic symbol.    Its always a good practice to use two letters together for a variable, never one letter.   Can you imagine doing a search and replace on "i" ?    Much easier to find ii than just i

0
 
lulu50Author Commented:
gdemaria:

I removed the array.  Please take a look it display the main menu correct but the submenu
is wrong. it is looping the same field for the length of the querry
for example
community (main menu)
   activities activities activities activities  ....
I am not sure what I am doing wrong.



<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>#DivID#</cfoutput>" class="innercontent"> 
						  	 <table>
<tr>
<td>&nbsp;</td>
</tr>
							  <tr>
							  <cfif #MenuID# neq "1">
							  <cfloop index="i" from="1" to="#DispSubMenu.recordcount#">
<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>#SubMenuName#</cfoutput></a></td>
						      </cfloop>
						      </cfif>
						     
</tr>
							  </table>
</div>
</cfloop>
</td>
</tr>

Open in new window

0
 
gdemariaCommented:
Curious, there are a few things I'm not sure about.  First, you have no where clause on your submenu, it is not restricting to any particular Main Menu at all... so the loop of the submenu should show every submenu for every main menu.

Also, it is important to scope your variables.   Without the scope, we can't be sure you are displaying the value from the query, you could be showing a form variable (I know this is a code snippet, not the full code)

Did you try putting the submenu into the database directly and see what it returns?   That would be good to know..

<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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
lulu50Author Commented:
gdemaria:
My Main menu and submenu are pulled from the database.
I am not using any type of form.

"you have no where clause on your submenu"

do you mean this [where SubMenuStatus = 'A']

SELECT MainMenu.MenuID,SubMenuName,SubMenuURL,DivID
  FROM MainMenu left join SubMenu on  MainMenu.MenuID = SubMenu.MenuID
where SubMenuStatus = 'A'
order by SubMenu.SubMenuName
0
 
gdemariaCommented:
> My Main menu and submenu are pulled from the database

I know.


> do you mean this [where SubMenuStatus = 'A']

You are pulling all menus and submenus in that query, is that what you mean to do?   Typically if you show a submenu, I think the submenu would be for ONE of the main menu items, you don't show ALL submenus of all Menus at once do you?





*** What do you get back from the database when you run this?


SELECT MainMenu.MenuID,SubMenuName,SubMenuURL,DivID
  FROM MainMenu left join SubMenu on  MainMenu.MenuID = SubMenu.MenuID
where SubMenuStatus = 'A'
order by SubMenu.SubMenuName


0
 
lulu50Author Commented:
Please see below
SubMenuID DIVID     MENUID        SUBMENUNAME       SUBMENUURL 
1         Jobs        6       Accounting/Finance    index.cfm 
2         Community   2       Activities            index.cfm 
3         ForSale     4       Antiques              index.cfm 
4         Housing     4       Any Real Estate       index.cfm 
5        ChatRooms    3       Arts                  index.cfm 
6        Services     7      Automotive             index.cfm 
7        Housing      4      Building Lot           index.cfm 
8        Housing      4      Co-op Unit             index.cfm 
9        Housing      4      Condominium Unit       index.cfm 
10       Housing      5      dd                     index.cfm 
11       Housing      4      Duplex                 index.cfm 
12       Housing      4      Farm                   index.cfm 
13       Housing      4      Housing swap           index.cfm 
14       Housing      4      Mobile/Manufactured Home index.cfm 
15       Housing      4      Multi-Family Home       index.cfm 
16       Housing      4      Offie/Commercial        index.cfm 
17       Housing      4      Parking/Storage         index.cfm 
18       Housing      4      Raw Land                index.cfm 
19       Housing      4      Rooms/Shared            index.cfm 
20       Housing      4      Row House              index.cfm 
21       Housing      4      Single Family Home     index.cfm 
22       Housing      4      Sublets/Temporary      index.cfm 
23       Housing      4      Townhouse/Townhome     index.cfm 
24       Housing      4     Vacation Rentals        index.cfm 
25       Housing      4      Vacation swap           index.cfm 
26       Home         1     Welcome                 index.cfm

Open in new window

0
 
lulu50Author Commented:
Main Menu Data
MAINMENUNAME MAINMENUSTATUS MAINMENUURL     MENUID  RELIDMAINMENU 
Home              A             index.cfm     1         Home 
Community         A             index.cfm     2        Community 
Chat Rooms        A             index.cfm     3        ChatRooms 
For Sale          A             index.cfm     4        ForSale 
Real Estate       A             index.cfm     5        Housing 
Jobs              A             index.cfm     6        Jobs 
Services          A             index.cfm     7        Services

Open in new window

0
 
gdemariaCommented:
Ok, I am not sure why you are getting the same submenu name repeated, but I do see other problems.

Your submenu will contains 25 names, each name in it's own table (a different table for each submenu).   That doesn't seem to be what you want, is it?

Perhaps you want to loop around the <TD> cell instead.  I moved the check for the menuID != 1 into the query

<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'
and   MenuID > 1
order by SubMenu.SubMenuName
</CFQUERY>


<div id="dolphin_inner">
<div id="<cfoutput>#DispSubMenu.DivID#</cfoutput>" class="innercontent"> 
<table>
 <tr>
   <td>&nbsp;</td>
 </tr>
 <tr>
    <cfloop query = "DispSubMenu">
    <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>
    </cfloop>
 </tr>
</table>
</div>

Open in new window

0
 
lulu50Author Commented:
I cannot do it like the code above because the div id should be pulled from the database.
<div id="dolphin_inner">
<div id="<cfoutput>#DispSubMenu.DivID#</cfoutput>" class="innercontent"> 
<table>
 <tr>
   <td>&nbsp;</td>
 </tr>
 <tr>
 <cfloop query = "DispSubMenu">
    <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>
    </cfloop>
 </tr>
</table>
</div>

Open in new window

0
 
lulu50Author Commented:
<CFQUERY DATASOURCE="lulu50_ChurchesBulleti" 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 > 1
order by SubMenu.SubMenuName
</CFQUERY>
0
 
gdemariaCommented:
Ok, I see it.  I don't think you need the full table though.  You can try the code below if you like.  

But this is a tangent,so back to the issue, you are saying that you only see ONE submenu name, and that name is repeated again and again (25 times) across the page.   Is that right?

<div id="dolphin_inner">
<cfloop query = "DispSubMenu">
  <div id="<cfoutput>#DispSubMenu.DivID#</cfoutput>" class="innercontent"> 
    <div 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>
    </div>
  </cfloop>
</div>

Open in new window

0
 
lulu50Author Commented:
no it's  still not working the submenu now is not displaying anything.
0
 
gdemariaCommented:
Not displaying anything?   I thought it was displaying the SAME item repeatedly?

can you add this on your page somewhere so we can see if the query is returning anything?

<cfdump var="#DispSubMenu#">

You should see a long down of the columns and records..
0
 
gdemariaCommented:
please post your current code, there must be something in there I'm missing.  It should display results, more than you need even..
0
 
lulu50Author Commented:
SubMenuID DIVID     MENUID        SUBMENUNAME       SUBMENUURL
1         Jobs        6       Accounting/Finance    index.cfm
2         Community   2       Activities            index.cfm
3         ForSale     4       Antiques              index.cfm
4         Housing     4       Any Real Estate       index.cfm
5        ChatRooms    3       Arts                  index.cfm
6        Services     7      Automotive             index.cfm
7        Housing      4      Building Lot           index.cfm
8        Housing      4      Co-op Unit             index.cfm
9        Housing      4      Condominium Unit       index.cfm
10       Housing      5      dd                     index.cfm
11       Housing      4      Duplex                 index.cfm
12       Housing      4      Farm                   index.cfm
13       Housing      4      Housing swap           index.cfm
14       Housing      4      Mobile/Manufactured Home index.cfm
15       Housing      4      Multi-Family Home       index.cfm
16       Housing      4      Offie/Commercial        index.cfm
17       Housing      4      Parking/Storage         index.cfm
18       Housing      4      Raw Land                index.cfm
19       Housing      4      Rooms/Shared            index.cfm
20       Housing      4      Row House              index.cfm
21       Housing      4      Single Family Home     index.cfm
22       Housing      4      Sublets/Temporary      index.cfm
23       Housing      4      Townhouse/Townhome     index.cfm
24       Housing      4     Vacation Rentals        index.cfm
25       Housing      4      Vacation swap           index.cfm
26       Home         1     Welcome                 index.cfm
0
 
gdemariaCommented:
why did you post the query results again?

I had asked for your current version of your code...
0
 
cfEngineersCommented:
I am confused about this loop
<cfloop index="i" from="1" to="#DispSubMenu.recordcount#">

it is not a query loop, so you are outputting the subname over and over for the length of the query
0
 
gdemariaCommented:
cfengineer, we dropped that part, check updates code posts.   Hopefully Lulu will post the most recent code so we can see what's happening...
0
 
cfEngineersCommented:
ah yes, dang browser was lagging sorry lol
0
 
lulu50Author Commented:
Sorry for the delay.
<cfloop query = "DispMainMenu">
<div id="Div1">
   <div id="<cfoutput>#RelIDMainMenu#</cfoutput>" class="innercontent"> 

    <table>
        <tr>
        <cfloop query="DispSubMenu">
        <cfif #DispMainMenu.MenuID# eq #DispSubMenu.MenuID#>
         <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>
        </cfloop>
        </tr>
    </table>

  </div>
</div>
</cfloop>

Open in new window

0
 
cfEngineersCommented:
I would put a query of the submenu inside the loop of the main menu
you could just query every submenu record once then use query of queries to enumerate and filter them.
0
 
cfEngineersCommented:
can you paste the entire code again all lines?
0
 
lulu50Author Commented:
sure.
I am all confused here what goes first.

<CFQUERY DATASOURCE="xx" 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="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 > 1
order by SubMenu.SubMenuName
</CFQUERY>


<tr>
<td colspan="2" >

<div id="dolphincontainer">
<div id="dolphinnav">
<ul> <---Please note that the Main Menu works fine --->
<cfloop query = "DispMainMenu">
  <li><cfoutput><a href="#MainMenuURL#" rel="#RelIDMainMenu#"><span>#MainMenuName#</span></a></cfoutput></li>
</cfloop>
</ul>
</div>
 
 
<---Here the div id is displaying the correct div id but not displaying the correct <a> SubMenuName--->
<cfloop query = "DispMainMenu">
<div id="Div1">
   <div id="<cfoutput>#RelIDMainMenu#</cfoutput>" class="innercontent">

    <table>
        <tr>
        <cfloop query="DispSubMenu">
       
        <cfif #DispMainMenu.RelIDMainMenu#  #DispSubMenu.DivID#>
        <cfdump var="#DispSubMenu.DivID#">
         <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>
        </cfloop>
        </tr>
    </table>

  </div>
</div>
</cfloop>

</td>
</tr>
<CFQUERY DATASOURCE="xx" 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="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 > 1
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>
  
  

<cfloop query = "DispMainMenu">
<div id="Div1">
   <div id="<cfoutput>#RelIDMainMenu#</cfoutput>" class="innercontent"> 

    <table>
        <tr>
        <cfloop query="DispSubMenu">
       
        <cfif #DispMainMenu.RelIDMainMenu#  #DispSubMenu.DivID#>
        <cfdump var="#DispSubMenu.DivID#">
         <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>
        </cfloop>
        </tr>
    </table>

  </div>
</div>
</cfloop>

</td> 
</tr>

Open in new window

0
 
lulu50Author Commented:
<cfif #DispMainMenu.RelIDMainMenu# eq #DispSubMenu.DivID#>

I missed to post the "eq" sign
0
 
gdemariaCommented:

<CFQUERY DATASOURCE="xx" 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="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 > 1
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>
  
  
<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>
        <tr>
        <cfloop query="DispSubMenu">
         <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>
        </cfloop>
        </tr>
    </table>

  </div>
</div>
</cfloop>

</td> 
</tr>

Open in new window

0
 
cfEngineersCommented:
line 15 and 58 need <table> and </table> tags but that looks good @gdemaria
0
 
lulu50Author Commented:
gdemaria:

very close I want to display 5 on each row
0
 
lulu50Author Commented:
VERY GOOD THANK YOU SO MUCH
0
 
cfEngineersCommented:
I am not sure about this, havent tested it.
<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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 13
  • 10
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now