Alternate colors for topic cells in forum.asp

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/66856?pagenum=1
05 November 2025, 02:40

Topic


texanman
Alternate colors for topic cells in forum.asp
14 April 2008, 09:48


Can this be done just as in post.asp? Any help is appreciated.<

 

Replies ...


Shaggy
14 April 2008, 10:48


Find the following on line 440 and add the code in green:
Code:
else
intI = 0 tT_STATUS = 0
tCAT_ID = 1
tFORUM_ID = 2
Find the following on line 480 and add the code in green:
Code:
		end if
if intI = 0 then
CColor = strAltForumCellColor
else
CColor = strForumCellColor
end if
Response.Write " <tr>" & vbNewLine & _
" <td bgcolor=""" & strForumCellColor & """ align=""center"" valign=""middle""><a href=""topic.asp?" & ArchiveLink & "TOPIC_ID=" & Topic_ID & """>"
Change the occurrences of strForumCellColor on lines 487, 535, 543, 544, 545, 552 & 554 to CColor.
Find the following on line 568 and add the code in green:
Code:
		rec = rec + 1 
intI = intI + 1
if intI = 2 then
intI = 0
end if
next
<
texanman
14 April 2008, 11:47


Shaggy:
You are the best. Thank you soooooooooo much. It works very well. smile<
Shaggy
14 April 2008, 12:13


You're welcome smile
<
phy1729
14 April 2008, 18:56


For your second block you could use
Code:
intI=(intI+1) mod 2
to condense it.<
Shaggy
15 April 2008, 04:24


Oh, there's many other ways to achieve this, some, such as your suggestion, more efficient than what I posted but, for the sake of consistency, I provided code that was already in use on other pages wink
<
phy1729
15 April 2008, 07:03


In that case consistency of efficiency is the best choice.<
texanman
15 April 2008, 15:26


Originally posted by phy1729
For your second block you could use
Code:
intI=(intI+1) mod 2
to condense it.

phy1729:

Can you elaborate what you mean? Thanks<
AnonJr
15 April 2008, 16:55


He's talking about using modulus division. I tend to use a similar (but not quite the same tongue) technique when doing this sort of thing in my work. While he's right that that approach is more elegant and probably more efficient, IMHO it probably won't make a noticeable difference.
Ask 10 programmers how to do something and you'll often get 20 different options at minimum. bigsmile<
phy1729
15 April 2008, 17:27


As AnonJr said it's a diffrent way to do the same thing +1 adds one and %2 divides by two and takes the remainder.
My personal favorite way to do this is i=i?0:1 which mean is i is true (1) i=0 else (0) i=1 Unfortunately that approach doesn't work in ASP.<
texanman
15 April 2008, 18:02


Originally posted by AnonJr

Ask 10 programmers how to do something and you'll often get 20 different options at minimum. bigsmile

Ah!! Programers are far better than Economists then. 50 economists will give you 50 different answers to the same question.

Have you heard about the old professor of Macroeconomics who year after year gave the same exam. Only the answer changed year after year! bigsmilecool
Thanks for the explanation.<
Andy Humm
20 April 2008, 07:42


Cool tweak,,, installed and all works satisfactorily.. I have observed with the alternate colour cell (strAltForumCellColor) if the number of post causes the thread to pagenate, the page links background colour remains as the original colour (strForumCellColor) see image below. However if the original cell background has additional pages it stays as the same colour ie both strForumCellColor. I am sure a genius will provide a simple solution..


kindest regards andy<
Shaggy
21 April 2008, 05:07


Find the following on line 792 of forum.asp (may be a couple of lines further down if you've already applied the changes above) and change the strForumCellColor to CColor or just delete the bgcolor attribute completely:
Code:
ref = "                      <td align=""right"" valign=""bottom"" bgcolor=""" & strForumCellColor  & """><font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>" 
<
Andy Humm
21 April 2008, 05:16


Perfick... Thank you as always..<
Shaggy
21 April 2008, 05:26


You're welcome smile
<
© 2000-2021 Snitz™ Communications