SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    australia
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Help with menu display!

    Someone please help me!!!

    why cant i get this script to output the way i want it to.


    <% ' ####### Menu Display #######

    Function menu_MainTop(cID)
    if dMode <> true then on error resume next
    Dim catCount

    Dim currentMenuButtonID, menuGroupCount, ContentsOptionSelected, firstMenuValue, s1, firstCatValue

    Dim fparentIDs
    if cID > 0 then fparentIDs = getParentIDs(cID)
    s = ""

    SQLQuery = "SELECT tblCategory.categoryName, tblCategory.hidden, tblMenuButtons.menuButtonName, tblMenuButtons.menuButtonLink, tblMenuButtons.loadInNewWindow, tblMenuButtons.menuButtonOnline, tblMenuButtons_Categories.categoryID, tblMenuButtons_Categories.MenuButtonID FROM tblCategory INNER JOIN (tblMenuButtons_Categories INNER JOIN tblMenuButtons ON tblMenuButtons.menuButtonID = tblMenuButtons_Categories.MenuButtonID) ON tblMenuButtons_Categories.categoryID = tblCategory.categoryID ORDER BY tblMenuButtons.menuButtonName, tblCategory.categoryName;"

    Set ds = objConn.Execute(SQLQuery)
    Set ds2 = nothing

    if not ds.BOF AND not ds.EOF then
    'options exist for this product
    g_k = 0
    menuGroupCount = 0
    catCount = 0

    firstMenuValue = false
    firstCatValue = false

    Do until ds.EOF

    menuGroupCount = menuGroupCount + 1

    if not ds("menuButtonID") = currentMenuButtonID then

    firstMenuValue = true

    currentMenuButtonID = ds("MenuButtonID")

    if ds("categoryID") = "" then s1 = s1 & "</ul><li>" %>


    <% s1 = s1 & "<li><a href=""#"">" & ds("menuButtonName") & "</a>"


    if firstCatValue = false AND catCount > 0 then s1 = s1 & "<li>" %>

    <%
    firstCatValue = false
    catCount = 0
    end if

    catCount = catCount + 1

    firstCatValue = true

    s1 = s1 & "<li>"
    s1 = s1 & "<a href=""categories.asp?cID=" & ds("categoryID") & """>" & ds("categoryName") & "</a>"
    s1 = s1 & "</li>"

    if fparentIDs <> "" then

    if CLng(nthField(fparentIDs, ",", 1)) = ds("categoryID") then
    s1 = s1 & listSubCats(ds("categoryID"), cID, fparentIDs, 1)
    end if
    end if
    %>


    <%
    firstCatValue = false
    firstMenuValue = false

    ds.MoveNext
    Loop

    %>

    <%
    end if

    ds.close
    set ds = nothing

    menu_MainTop = s1

    end Function


    ' ############## %>

    This is how it i want it to display, i have tried for hours but cant get it.

    <div class="menuTop">
    <ul>
    <li><a href="#">+1top Button</a>
    <ul>
    <li><a href="categories.asp?cID=1">Boy T's</a></li>
    <li><a href="categories.asp?cID=11">Everyday T's</a></li>
    <li><a href="categories.asp?cID=2">Girls T's</a></li>
    </li>
    </ul>
    <li><a href="#">Test Button 123</a>
    <ul>
    <li><a href="categories.asp?cID=18">Custom T's</a></li>
    <li><a href="categories.asp?cID=11">Everyday T's</a></li>
    <li><a href="categories.asp?cID=7">Men T's</a></li>
    <li><a href="categories.asp?cID=9">Shirts</a></li>
    </ul>
    </li>
    </ul>
    </div>


    PLEASE HELP ANYONE!

  2. #2
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    australia
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also can some please tell me how i can enclose my html in a textbox on this site for easier viewing, ive seen it in several posts but not sure how its done.

    Any help with the above problems would be really appreciated as i have a deadline by tomorrow and this has confused me so much.

    Thanks to all in advance

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    australia
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I forgot to mention the problem im having is where the <ul> & <li> are being distributed through the script. The final oputput should be exactly like the result below and should continue with the same proceedure until eof. Basicly the menu buttons get loaded and then categories with the same button id get loaded below the reletive button.


    Please help, im still plugging away and getting quite desperate

  4. #4
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the problem may be with your "if" statements. you are checking for blanks and booleans but they database may not be formatted to match what you are checking for.

    be sure your if statements are checking for the correct field format in the database.

    otherwise there is little anyone can do to assist because there is no way for someone to see your database

  5. #5
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Regarding structured code, just use the box at the top-right of the Advanced post box called Select Syntax... and choose which code type you want to show. Example ...

    [ HIGHLIGHT="HTML4Strict"]<p>This is some HTML</p>[/HIGHLIGHT]

    Remove the space between [ and HIGHLIGHT and it becomes

    Code HTML4Strict:
    <p>This is some HTML</p>
    Seemples.
    Ian Anderson
    www.siteguru.co.uk

  6. #6
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    australia
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by siteguru View Post
    Regarding structured code, just use the box at the top-right of the Advanced post box called Select Syntax... and choose which code type you want to show. Example ...

    [ HIGHLIGHT="HTML4Strict"]<p>This is some HTML</p>[/HIGHLIGHT]

    Remove the space between [ and HIGHLIGHT and it becomes

    Code HTML4Strict:
    <p>This is some HTML</p>
    Seemples.
    Thankyou, this should be posted on the site somewhere or made available as an add in. Thanks again.

  7. #7
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    australia
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    Ok i have figured how to het this to display correctly but now im having a problem with what its loading under each button. At the moment it seems to be looping through each result and simply duplicating the results under each button and not based on the buttons id. i have included the full code in a freindly HTML4Strict box thanks to 'SiteGuru' Thanks again.

    I would really appreciate some help with this last little issue that im having.
    Thanks to all that have tried and will try and to those that dont, what comes around goes around.

    But thanks anyway


    Code ASP:
    <p>
     
     <%  
    Function testmenu(cID)
      if dMode <> true then on error resume next
      Dim fparentIDs, themenuButtonID, menuButtonID, currentMenuButtonID, firstMenuValue
      if cID > 0 then fparentIDs = getParentIDs(cID)
      s = ""
     
      if isNumberValid(session("eCart_membershipID")) AND session("eCart_membershipID") > 0 then
        SQLQuery = "SELECT tblCategory.categoryID, tblCategory.categoryName, tblCategory.menuAppearance, tblCategory.pageContents FROM tblCategory INNER JOIN tblMembershipDiscounts ON tblCategory.categoryID = tblMembershipDiscounts.categoryID WHERE (((tblCategory.parentID)=0) AND ((tblCategory.menuAppearance)=1) AND ((tblMembershipDiscounts.membershipID)=" & prepLong(session("eCart_membershipID")) & ") AND ((tblMembershipDiscounts.hidden)=" & prepBoolean("false") & ")) ORDER BY tblCategory.categoryName;"
      else
        SQLQuery = "SELECT tblMenuButtons.menuButtonID, tblCategory.categoryName, tblCategory.categoryID, tblCategory.hidden FROM ((tblMenuButtons LEFT JOIN tblMenuButtons_Categories ON tblMenuButtons.menuButtonID = tblMenuButtons_Categories.menuButtonID) LEFT JOIN tblCategory ON tblMenuButtons_Categories.categoryID = tblCategory.categoryID) WHERE tblMenuButtons.menuButtonID = tblMenuButtons_Categories.menuButtonID AND tblCategory.hidden=" & prepBoolean("false") & " ORDER BY tblCategory.categoryName, tblMenuButtons.menuButtonID;"
     
      end if
     
     
      Set ds = objConn.Execute(SQLQuery)
      Set ds2 = nothing
      if not ds.BOF AND not ds.EOF then
     
     
        g_k = 0
    response.write"<ul>"	
     
        do until ds.eof
     
          'g_k = g_k + 1
          'if g_k > 2 then g_k = 1
          s = s & "<li>"
          s = s & "<a href=""categories.asp?cID=" & ds("categoryID") & """>" & ds("categoryName") & ds("menuButtonID") &"</a>"
    	  s = s & "</li>"
          if fparentIDs <> "" then
            if CLng(nthField(fparentIDs, ",", 1)) = ds("categoryID") then s = s & listSubCats(ds("categoryID"), cID, fparentIDs, 1)
          end if
     
          ds.moveNext
        loop
    s = s & "</ul> "
      end if
     
     
      ds.close
      set ds = nothing
     
      testmenu = s
     
    end Function
     
     
     
    loadMenuButtonsTop ()
    'dim categoryName
    Sub loadMenuButtonsTop()
    dim objConn, ds4, themenuButtonID, themenuButtonName, themenuButtonLink, theloadInNewWindow, themenuButtonLocation, menu1categories
     if dMode <> true then on error resume next
     Set objConn = Server.CreateObject("ADODB.Connection")
      objConn.Open dbConnectionStr
    'set ds = CreateObject("ADODB.Connection") 
    'ds.open
     
    SQLQuery = "SELECT menuButtonID, menuButtonName, menuButtonLink, loadInNewWindow, menuButtonLocation FROM tblmenuButtons ;"
    Set ds4 = objConn.Execute(SQLQuery)
     
     if not ds4.eof AND not ds4.bof then
    j=0
     %>  
     
     
    <div class="menuTop">
    		<ul>
           <% do until ds4.eof 
    	   theMenuButtonID = ds4("menuButtonID")
    themenuButtonName = ds4("menuButtonName")
    themenuButtonLink = ds4("menuButtonLink")
    theloadInNewWindow = ds4("loadInNewWindow")
    'menuButtonLocation = ds4("menuButtonLocation")
    j = j + 1 %>
    <li><a href="<%= themenuButtonLink %>" <%if theloadInNewWindow = true then send "target=""_blank""" %>><%= themenuButtonName %></a>
     
     
                        <% 
     
    currentCategory = request.queryString("cID")
    if not isNumberValid(currentCategory) then currentCategory = 0
    'if menuButtonID = 1 then
     send testmenu(currentCategory)
    ' end if 
     %>
     
              </li>
     
    <% if j = 8 then exit do
     ds4.moveNext
      loop %>
     
    		</ul>
    	</div>
     
     
    <%'End Navigation Head Top Above Head Banner %>
     
        <% end if
     
     ds4.close
    set ds4 = nothing
    end sub
     
     
     
    %>  </p>
    Last edited by Mittineague; Sep 17, 2010 at 10:37. Reason: changing from HTML to ASP bbcode

  8. #8
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    There is also an ASP option as well - use the Go Advanced button when making your posts and you'll see it.
    Ian Anderson
    www.siteguru.co.uk


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •