I've got a script that was created in ASP and now I need to use it in PHP.
It's basically populating a navigation and sub navigation. The initial navigation is populated by a table called category and the subnav is populated by a table called subcat.
The structure is something like this:
Home
Products
item1
item2
item3
item4
Services
serv1
serv2
serv3
serv4
About
Contact
I've got it to work to an extent, but the subnav is showing on each when it should only be showing on the particular category.
I've attached 2 jpegs, the first is how the nav used to work in ASP, and the second is the PHP version.
Here is my ASP code, PHP code in code box:
<%
Dim RSnav
Dim RSnav_numRows
<%
Dim RSsubcat__MMColParam
RSsubcat__MMColParam = "1"
If (Request.QueryString("cat") <> "") Then
RSsubcat__MMColParam = Request.QueryString("cat")
End If
%>
<%
Dim RSsubcat
Dim RSsubcat_numRows
<ul class="subnav">
<%
While ((Repeat1__numRows <> 0) AND (NOT RSnav.EOF))
ID = RSnav.Fields.Item("categoryID").Value
%>
<% If ID = request.querystring("cat") + 0 Then %>
<li class="open_nav"><%=(RSnav.Fields.Item("categoryName").Value)%>
<% else %>
<li><a href="products-list.asp?cat=<%=(RSnav.Fields.Item("categoryID").Value)%><% if RSnav.Fields.Item("categoryFirst").Value <> "" then %>&sub=<%=RSnav.Fields.Item("categoryFirst").Value%><% end if %>"><%=(RSnav.Fields.Item("categoryName").Value)%></a>
<% end if %>
<ul>
<% If Repeat1__index = request.querystring("cat") -1 Then
While ((Repeat3__numRows <> 0) AND (NOT RSsubcat.EOF))
subID = RSsubcat.Fields.Item("subcatID").Value
%>
<% If subID = request.querystring("sub") + 0 Then %>
<li><%=(RSsubcat.Fields.Item("subcatName").Value)%></li>
<% else %>
<li><a href="products-list.asp?cat=<%=request.querystring("cat")%>&sub=<%=(RSsubcat.Fields.Item("subcatID").Value)%>"><%=(RSsubcat.Fields.Item("subcatName").Value)%></a></li>
<% end if %>
<%
Repeat3__index=Repeat3__index+1
Repeat3__numRows=Repeat3__numRows-1
RSsubcat.MoveNext()
Wend
end if
%>
</ul>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
RSnav.MoveNext()
Wend
%>