Alternate colors for topic cells in forum.asp - Posted (1642 Views)
Junior Member
texanman
Posts: 410
410
Can this be done just as in post.asp? Any help is appreciated.<
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Support Moderator
Shaggy
Posts: 6780
6780
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
<
Search is your friend “I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Posted
Junior Member
texanman
Posts: 410
410
Shaggy:
You are the best. Thank you soooooooooo much. It works very well. smile<
Posted
Support Moderator
Shaggy
Posts: 6780
6780
You're welcome smile
<
Search is your friend “I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Posted
Average Member
phy1729
Posts: 589
589
For your second block you could use
Code:
intI=(intI+1) mod 2
to condense it.<
Posted
Support Moderator
Shaggy
Posts: 6780
6780
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
<
Search is your friend “I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Posted
Average Member
phy1729
Posts: 589
589
In that case consistency of efficiency is the best choice.<
Posted
Junior Member
texanman
Posts: 410
410
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<
Posted
Forum Moderator
AnonJr
Posts: 5768
5768
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<
Posted
Average Member
phy1729
Posts: 589
589
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.<
Posted
Junior Member
texanman
Posts: 410
410
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.<
You Must enter a message