Jump to content

show if statement


prichardson
 Share

Recommended Posts

Hello,Can anyone help me please.I have a navigation that has 4 levels and it is done on a node system where the category(level) has an ID which has child levels e.g. level 2, level 3 etc.. and they will know which level 1 to be associated by the 'parent id' i.e. the level 1 id.I have products for every levels. Except this piece of code says if there is a catID then display products. But when you first arrive ont he page there is no catId(until you click on one of the levels). So I need to have the same code that states if the catid equals nothing then display the 4 products in a table. To do this i want to do a "show if". I got it like this so far, so can anyone help me out please:

*******If NO catID (i.e. when i first arrive on page) to display 4 pictures in the page within a table)************<%if catID = "" then%><% If rsP.EOF And rsP.BOF Then %>	  	  <table width="100%" border="0" cellspacing="0" cellpadding="0">		<tr>		  <td width="160"><div align="center"> <a href="<%=strURLPath%>test3.asp?catID=1"><img src="assets_cm/FILES/image/bearings1.jpg" alt="<%=DoApostrophe(strProductTitle)%>" width="120" height="90" border="0"></a> 			</div></td>		  <td width="160"><div align="center"> <a href="<%=strURLPath%>test3.asp?catID=2"><img src="assets_cm/FILES/image/bearings2.jpg" alt="<%=DoApostrophe(strProductTitle)%>" width="120" height="90" border="0"></a> 			</div></td>		</tr>		<tr>		  <td width="160"><div align="center"> <a href="<%=strURLPath%>test3.asp?catID=3"><img src="assets_cm/FILES/image/bearings3.jpg" alt="<%=DoApostrophe(strProductTitle)%>" width="120" height="90" border="0"></a> 			</div></td>		  <td width="160"><div align="center"> <a href="<%=strURLPath%>test3.asp?catID=4"><img src="assets_cm/FILES/image/bearings4.jpg" alt="<%=DoApostrophe(strProductTitle)%>" width="120" height="90" border="0"></a> 			</div></td>		</tr>	  </table><% End If %>*****************************************If there is a catId then do this ... ****<%if catID <> "" thenset rsP = objconn.execute ("SELECT * from products where catID=" & catID )while not rsP.eof%>	 			<form action="test3.asp" method="post" name="textsubmitform" id="textsubmitform"><img src="assets_cm/FILES/image/<%=rsP("ximage")%>" border="0">   <%=rsP("name")%>  £ <%=rsP("price")%> etc etc..

Link to comment
Share on other sites

Try something like this...<% if catID = "" then %> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="160"><div align="center"> <a href="<%=strURLPath%>test3.asp?catID=1"><img src="assets_cm/FILES/image/bearings1.jpg" alt="<%=DoApostrophe(strProductTitle)%>" width="120" height="90" border="0"></a> </div></td> <td width="160"><div align="center"> <a href="<%=strURLPath%>test3.asp?catID=2"><img src="assets_cm/FILES/image/bearings2.jpg" alt="<%=DoApostrophe(strProductTitle)%>" width="120" height="90" border="0"></a> </div></td> </tr> <tr> <td width="160"><div align="center"> <a href="<%=strURLPath%>test3.asp?catID=3"><img src="assets_cm/FILES/image/bearings3.jpg" alt="<%=DoApostrophe(strProductTitle)%>" width="120" height="90" border="0"></a> </div></td> <td width="160"><div align="center"> <a href="<%=strURLPath%>test3.asp?catID=4"><img src="assets_cm/FILES/image/bearings4.jpg" alt="<%=DoApostrophe(strProductTitle)%>" width="120" height="90" border="0"></a> </div></td> </tr> </table><% Else %> <% if catID <> "" thenset rsP = objconn.execute ("SELECT * from products where catID=" & catID )while not rsP.eof%> <form action="test3.asp" method="post" name="textsubmitform" id="textsubmitform"><img src="assets_cm/FILES/image/<%=rsP("ximage")%>" border="0">   <%=rsP("name")%>  £ <%=rsP("price")%> etc etc..<% End if %>'This is the ENDIF for checking catID="".

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...