Hi all, I'm hoping that someone out there can help me
Here's the task... I need to manipulate some code (see below) so I can attribute a background color to a set of categories/subcategories. I will add a column to the categoreies table in access in order to specify the color - i.e. #ffffff
But I need some help to edit the code - to call the new field 'catbgcolor' which will be a TD attribute - i.e. normally <TD BGCOLR=#FFFFFF>
Object is to color code my category links to make site navigation easier
Any help would be appreciated
Dave
Here's the code:
------------------------------------
dim dbc
shoppageheader
shopopendatabase dbc
Displaycategories
shopclosedatabase dbc
shoppagetrailer
'************************************************* **************************
sub Displaycategories
dim sql, rs, level, rc, catdescription, spacing, categoryid
dim highercategoryid, hassubcategory
highercategoryid=0
Generatesql sql, highercategoryid
set rs=dbc.execute(sql)
CreateCattable
do while not rs.eof
Getcategoryfields rs,categoryid, hassubcategory, catdescription, rc
If rc=0 then
spacing=0
Formatcategory categoryid, catdescription, spacing
If hassubcategory<>"" then
Formatsubcategories categoryid,spacing
end if
end if
rs.movenext
loop
closerecordset rs
Response.write "</td></tr></table>"
end sub
Sub Createcattable
Response.write "<table width='60%'>"
response.write "<tr>"
response.write "<td align=left>"
end sub
'
Sub Getcategoryfields (rs, categoryid, hassubcategory, strcategory, rc)
dim strcathide
categoryid=rs("categoryid")
strcategory=rs("catdescription")
hassubcategory=rs("hassubcategory")
If isnull(hassubcategory) then
hassubcategory=""
end if
strcathide=rs("cathide") ' hide field
if isnull(strcathide) then
rc=0
else
rc=4
end if
end sub
Sub Generatesql (sql, highercategoryid)
SQL="Select * from categories "
sql = Sql & " where highercategoryid=" & highercategoryid
if getconfig("xproductmatch")="Yes" then
sql=sql & " and productmatch='" & xproductmatch & "'"
end if
if getconfig("xproductmatchcustomer")="Yes" then
if GetSess("CustomerProductGroup")<>"" then
sql=sql & " and customermatch='" & getsess("customerProductgroup") & "'"
end if
end if
Handle_selectcategoriesbylanguage sql
sql=sql & " order by " & Getconfig("xsortcategories")
end sub
Sub Formatcategory (id, name, spacing)
dim i
If spacing>0 then
for i = 0 to spacing
response.write " "
next
end if
response.write "<a HREF=""shopdisplayproducts.asp?id=" & id & "&cat=" & Server.URLEncode(name) & """>" & name & "</a>" & "<br>" & vbcrlf
end sub
Sub Formatsubcategories (categoryid, spacing)
dim sql, rs, rc, catdescription, hassubcategory
Generatesql sql, categoryid
Set rs=dbc.execute(sql)
spacing=spacing+1
do while not rs.eof
Getcategoryfields rs,categoryid, hassubcategory, catdescription, rc
If rc=0 then
Formatcategory categoryid, catdescription, spacing
If hassubcategory<>"" then
Formatsubcategories categoryid, spacing
end if
end if
rs.movenext
loop
spacing=spacing-1
closerecordset rs
end sub
sub Handle_selectcategoriesbylanguage (sql)
If getconfig("xselectproductsbylanguage")="Yes" and getsess("language")<>"" then
sql=sql & " and (catlanguage='" & getsess("language") & "'"
sql=sql & " or catlanguage is null)"
end if
end sub
%>
-----------------------------------------