webForumDet fria alternativet

Antal rader

4 svar · 245 visningar · startad av Robson

RobsonMedlem sedan dec. 2001200 inlägg
#1

Hej,
Får inte ordning på antal rader i detta script. Produkterna visas i 2 rader med 4 kolumner. Jag vill utöka det till 3 rader med 4 kolumner. Har testat att ändra

const ROWS_PER_PAGE = "8"
const FIRST_ROW = "7"

men får det inte att funka iallafall...

Någon?

Robson

<%
Response.Buffer = TRUE 
%>
<%
 

on error resume next

Dim Catid	
Dim catDesc 
Dim ParentCatid 
Dim CatImage 
Dim str 
Dim imgPath 
Dim pCatId 
Dim pProdId 
Dim footerParam 
Dim quantityVal 
Dim price
Dim tableRowTop
Dim tableRow
Dim counter
Dim ar
Dim iCol
Dim iRow
Dim theCurrentPage
Dim theFirstRow
Dim theLastRow
Dim Pmsg
Dim CatVal
Dim str1
Dim str2

pProdId = request.Form("ProdID")
pCatId = request.Form("itemID")
price = request.form("price")
Pmsg = request.form("extraextraInpMsg")

const ROWS_PER_PAGE = "8"
const FIRST_ROW = "7"

footerParam = Cint(footerParam)
quantityVal = Cint(quantityVal)
	
footerParam = 0
quantityVal = 0
tableRow	= ""
tableRowTop = ""
CatVal		= ""
	
pProdId = request.Form("ProdID")
pCatId = request.Form("itemID")
price = request.form("price")
Pmsg = request.form("extraextraInpMsg")
	
'showval
		
if pCatId = "" And Pmsg = ""
set rs = db_conn.execut ("SELECTCatid,catDesc,ParentCatid,CatImage FROM product_categories WHERE ParentCatid=1 AND Catid<>1 ORDER BY catDesc")
			if err.number <> 0 then	
				error_text = TrapError ("FILE: products_content.asp FUNCTION: select1", ERR_PROD_SEL1) 
				response.End 
			end if 
		if rs.eof then
			response.Write NO_FOUND
		end if 	
	elseif Pmsg <> "" then
		set rs = db_conn.execute("SELECT products.ProductID, description, price, ThumbPth FROM products, categories_products WHERE products.ProductID=categories_products.Prodid AND categories_products.Catid="& pProdId&" AND active=-1 ORDER BY description")
			if err.number <> 0 then	
				error_text = TrapError ("FILE: products_content.asp FUNCTION: select2", ERR_PROD_SEL2) 
				response.End 
			end if 
		if rs.eof and pCatId="" then 
			response.Write NO_FOUND         
		end if 	
	else	
		set rs = db_conn.execute("SELECT Catid,catDesc,ParentCatid,CatImage FROM product_categories WHERE ParentCatid=" &pCatId& " AND Catid<>1 ORDER BY catDesc")
			if err.number <> 0 then	
				error_text = TrapError ("FILE: products_content.asp FUNCTION: select2", ERR_PROD_SEL2) 
				response.End 
			end if 
		if rs.eof and pCatId="" then 
			response.Write NO_FOUND         
		end if 
	end if 
	%>

	<%

	
	theCurrentPage = Trim(Request("theCurrentPage"))
	If theCurrentPage = "" Then theCurrentPage = ROWS_PER_PAGE
		theFirstRow = CInt(theCurrentPage) - CInt(FIRST_ROW)
		theLastRow = theCurrentPage
		counter = 0
if not rs.eof then
    ar = rs.GetRows
end if
	rs.close
set rs=nothing
if isarray(ar) then
CAll BreadCrumb(PageTitle,Pmsg,pProdId,pCatId,CatVal)
	Response.Write "<table border=2 width=""560"" bordercolor=#EFEFEF align=""left"" cellpadding=""10"" cellspacing=""0""><tr style=""padding-left: 22px;"">"
  for iRow = 0 to ubound(ar,2)
			counter = counter + 1
if (counter > theCurrentPage-8) and (counter <= clng(theCurrentPage)) then
      if iRow>0 and iRow mod 4 = 0 then
          response.write "</tr><tr>"
      end if
			Response.write "<td>"
		for icol = 0 to ubound(ar,1) - 1 
				if icol mod 4 = 0 then
					str1 = str1 & "<input type=hidden name=cid_" & ar(0,iRow) & "  value='" & ar(0,iRow) & "'><br>" & vbcrlf
				End if
			if not isnumeric(ar(iCol,iRow)) then
				Response.Write "<table border=0  align=""center"" height=""180"">"
				 str1 = str1 & "<input type=hidden name=cdesc_" & ar(0,iRow) & " value='" & ar(iCol,iRow) & "'><br>" & vbcrlf
		
				response.write "<tr><td width=""150"" valign=""top""  class=""LittleHeadings"">" & ar(iCol,iRow) & "</tr></td>" & vbcrlf
			end if  
		next
		
	
			response.write "<tr><td valign=""top"" width=""150""><img src='" & ar(iCol,iRow) & "'>&nbsp;</tr></td></table>"
		if pCatId = "" And Pmsg = "" then
			response.write "<a href='#' onClick='viewSubCategory(" & ar(0,iRow) & ");return false;'><div align=""right""><img src=""images/content_header_images/more.jpg"" border=""0"" alt=""View Sub Catagories""></div></a>" & Vbcrlf & Vbcrlf	
		elseif Pmsg <> "" then	
			response.write "<a href='#' onClick='viewProdDetails(" & ar(0,iRow) & ");return false;'><img src=""images/content_header_images/n6.jpg"" border=""0"" alt=""View Product Information""></div></a>" & Vbcrlf & Vbcrlf
		else
			response.write "<a href='#' onClick='viewProdCategory(" & ar(0,iRow) & ");return false;'><img src=""images/content_header_images/more.jpg"" border=""0"" alt=""View Products""></div></a>" & Vbcrlf & Vbcrlf
		end if     
			response.write "</td>"
end if		
	 if Cint(counter) > Cint(theCurrentPage) then exit for   		
  next
 
  do until iRow mod 4 = 0
     response.write "<td width=""150"">&nbsp;</td>"
      iRow = iRow + 1
  loop
	erase ar
else
	'response.Write NO_PRODUCTS
end if
%>

<%
Call displayNextPrevious(counter, theFirstRow, theLastRow)
%>
@ndersMedlem sedan juni 200032 969 inlägg
#2

Snälla, använd [kod]-taggar så det går att läsa koden ordentligt.

Mvh

RobsonMedlem sedan dec. 2001200 inlägg
#3

Så här???

Fick inte bort det...

WickmarkMedlem sedan juli 2003162 inlägg
#4

Nope :D

neeej!
-------------------------------------------------------------------------------
Ta bort den posten över denna, och redigera den översta. I början av koden skriver du:

[ KOD ] (utan mellanrum)

och i slutet:
[ /KOD ] (igen utan mellanrum :))
-------------------------------------------------------------------------------
[ kod ]
<%
Response.Write("Hello World!")
%>
[/ kod ]
blir...

<%
   Response.Write("Hello World!")
%>

-------------------------------------------------------------------------------
GL
MVH
Wickmark

WickmarkMedlem sedan juli 2003162 inlägg
#5

Puttar upp tråden igen, för du inte har fått något svar, eftersom du hade inte klamrat in din kod!

Jag förstår inte riktigt ditt problem, men jag hittade ett litet fel; som jag kan tipsa dig med:

SELECTCatid,catDesc,ParentCatid,CatImage FROM product_categories

ska väl endå vara:

SELECT Catid,catDesc,ParentCatid,CatImage FROM product_categories

Sen det där om const koden:
- Siffror som är skrivna mellan citattecken (") behandlas ju inte likadant som siffror utan citattecken! Det vet du säkerligen redan, men borde du inte testa att ta bort de där citattecknen ?
:e

Edit:
Hittade ett till fel:

if pCatId = "" And Pmsg = ""
set rs = db_conn.execut

(saknar e (execute))

137 ms totalt · 3 externa anrop · v20260731065814-full.fb544a5a
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
135 ms — hämta tråd, inlägg och bilagor (db)