<%
IF REQUEST("categoria") = "" THEN
%>
<%
ELSE
Set setCon = new Conn
setCon.strType = "MySQL"
setCon.strServer = "75.125.79.122"
setCon.strDB = "jessepi_bluehand"
setCon.strUser = "bluehand"
setCon.strPass = "whitedog"
Function Nav(id_categoria)
Dim SQL
Dim Values
Dim html
SQL = "SELECT idcategoria, nome_categoria, idcategoria_parent FROM categorias WHERE idcategoria = " & id_categoria
'Response.Write(SQL)
Values = setCon.Exec(SQL)
html = ""
If Values(2,0) <> 0 Then
html = html & Nav(Values(2,0)) & " > "
End If
html = html & "" & Values(1,0) & ""
Nav = html
End Function
Function Title(id_categoria)
Dim SQL
Dim Values
Dim html
SQL = "SELECT idcategoria, nome_categoria FROM categorias WHERE idcategoria = " & id_categoria
'Response.Write(SQL)
Values = setCon.Exec(SQL)
html = ""
html = html & ""
html = html & ""& Values(1,0) &"
"
Response.Write(html)
End Function
Function Cat(id_categoria)
Dim SQL
Dim Values
Dim Img
Dim Html
SQL = "SELECT idcategoria, nome_categoria FROM categorias c"
SQL = SQL & " WHERE projetos_idprojeto = 5"
SQL = SQL & " AND idcategoria_parent = " & id_categoria
SQL = SQL & " ORDER BY nome_categoria"
Values = setCon.Exec(SQL)
Html = ""
if IsArray(Values) then
Html = Html & "Categorias
"
For i = 0 to uBound(Values, 2)
Html = Html & ""
Html = Html & "
" & Values(1,i) & "
"
SQL = "SELECT imagem_g FROM produtos p"
SQL = SQL & " WHERE categorias_idcategoria = " & Values(0,i)
SQL = SQL & " ORDER BY RAND()"
Img = setCon.Exec(SQL)
if Not IsArray(Img) then
Html = Html & "

"
Else
Html = Html & "
 &")
"
End If
Html = Html & "
"
Next
End If
Response.Write(Html)
End Function
Function Pdt(id_categoria)
Dim SQL
Dim Values
Dim Html
SQL = "SELECT idproduto, nome_produto, descricao_produto, imagem_g FROM produtos"
SQL = SQL & " WHERE categorias_idcategoria = " & id_categoria
SQL = SQL & " ORDER BY destaque DESC, nome_produto ASC"
Values = setCon.Exec(SQL)
Html = ""
if IsArray(Values) then
Html = Html & "Produtos
"
For i = 0 to uBound(Values, 2)
Html = Html & ""
Html = Html & "
" & Values(1,i) & "
"
Html = Html & "
"
Html = Html & "
" & formatBR(Values(2,i)) & "
"
Html = Html & "
"
Next
End If
Response.Write(Html)
End Function
%>
<% Title(Request("categoria")) %>
<% Cat(Request("categoria")) %>
<% Pdt(Request("categoria")) %>
<%
END IF
%>