#1
  1. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jan 2004
    Location
    Budapest
    Posts
    1,702
    Rep Power
    67

    Help w/ Categorized Loop Iteration


    I am not sure why I am having problems with this but I am. I have a web page that displays a menu for a Japanese restaurant as seen here - Menu

    As you can see the menu is broken up into categories, such as Appetizers, Carpaccio, etc.

    I have a recordset that I am looping through and I have been able to code it to output a category header when the category changes. What I am trying to do is wrap the whole thing in a div. I don't have a problem putting in the opening div tag (w/ the header of course), but it is the closing div tag that is troubling me.

    Here is my code

    Code:
    <%
    
    Do Until rs.eof 
    
    
    If varx <> rs("cat_id") Then
    response.write "<h3 class='category_title'>" & rs("category") & "</h3>" & vbcrlf
    If rs("description") <> "" Then 
    response.write "<p class='category_desc'>" &  rs("description") & "</p>" & vbcrlf
    End If
    varx = rs("cat_id")
    End If
    
    
    response.write "<div  class='menu_item'>" & vbcrlf
    response.write "<h3><span>" & rs("Item_Name") & "</span></h3>" & vbcrlf
    if rs("Item_Desc") <> "" Then
    response.write "<p>" & rs("Item_Desc") & "</p>" & vbcrlf
    End If
    response.write "</div>" & vbcrlf
    response.write "<div class='menu_item_price'>6.5</div>" & vbcrlf & vbcrlf
    
    rs.movenext
    
    
    Loop
    %>
    Last edited by thall89553; March 14th, 2012 at 12:30 AM.
    Today the world, tomorrow the universe...

IMN logo majestic logo threadwatch logo seochat tools logo