How to change the colors of the Winning and Losing picks on

Post here to discuss topics relate to the 4.x version for the ASP Football Pool software program. All support topics should go here.
Post Reply
User avatar
philwojo
Posts: 143
Joined: Mon Aug 26, 2013 4:22 pm

How to change the colors of the Winning and Losing picks on

Post by philwojo »

I had done this last year, and I forgot about it until today. I have changed the code in the /includes/common.asp file to make it so that a Correct pick and an Incorrect Pick now are different colors than an unplayed game.

So by default all the program did was to make a correct pick "BOLD" but still black. An incorrect pick had a line put through it, and those were good, but I wanted to have more. So now I make my correct picks turn "lime green" and my incorrect picks still have a line put through them, but they also turn "red". Any unplayed games still show in the black. So it is really easy to see results on the page.

To accomplish this open your /includes/common.asp file and then:

Find for an "Incorrect Pick":

Code: Select all

	'--------------------------------------------------------------------------
	' Formats a string to indicate an incorrect pick.
	'--------------------------------------------------------------------------
	function FormatIncorrectPick(str)

		FormatIncorrectPick = "<span style=""text-decoration: line-through;"">" & str & "</span>"

	end function
Change it to look like this:

Code: Select all

	'--------------------------------------------------------------------------
	' Formats a string to indicate an incorrect pick.
	'--------------------------------------------------------------------------
	function FormatIncorrectPick(str)

		FormatIncorrectPick = "<span style=""text-decoration: line-through; color:red"">" & str & "</span>"

	end function
Now Find for a Winning Pick:

Code: Select all

	' Formats a string to indicate the game winner.
	'--------------------------------------------------------------------------
	function FormatWinner(str)

		if USE_POINT_SPREADS then
			FormatWinner = "<em>" & str & "</em>"
		else
			FormatWinner = "<strong>" & str & "</strong>"
		end if

	end function
And change it to look like this:

Code: Select all

	'--------------------------------------------------------------------------
	' Formats a string to indicate the game winner.
	'--------------------------------------------------------------------------
	function FormatWinner(str)

		if USE_POINT_SPREADS then
			FormatWinner = "<em>" & str & "</em>"
		else
			FormatWinner = "<span style=""color:limegreen; Font-weight:bold;"">" & str & "</span>"
		end if

	end function
Where you see the "color:xxxxxxx" parameter, feel free to change to to any colors you like, but here is how mine looks as of now, or at least a snippet of it so you can see a preview.

Image

Hope this helps.

Phil
User avatar
philwojo
Posts: 143
Joined: Mon Aug 26, 2013 4:22 pm

Re: How to change the colors of the Winning and Losing picks

Post by philwojo »

Thought I would bump this to the top for 2014 as it kind of got buried. A simple change, but I think it really adds to the results page personally.

Phil
lurkmaster1
Posts: 11
Joined: Fri Jul 18, 2014 10:35 am

Re: How to change the colors of the Winning and Losing picks

Post by lurkmaster1 »

nice tweak. just added it to mine.
e93octane
Posts: 5
Joined: Sun Aug 31, 2014 9:21 pm

Re: How to change the colors of the Winning and Losing picks

Post by e93octane »

Very Nice.. it seems to carry over to the weekly schedule.. the winner is in green but the loser is not in red or the strike through.. is there a way to get it there also...
User avatar
philwojo
Posts: 143
Joined: Mon Aug 26, 2013 4:22 pm

Re: How to change the colors of the Winning and Losing picks

Post by philwojo »

I will have to look at the code more that wasn't my intention so it might take some digging. Probably won't get to it until Monday though.

Phil
e93octane
Posts: 5
Joined: Sun Aug 31, 2014 9:21 pm

Re: How to change the colors of the Winning and Losing picks

Post by e93octane »

Great... thanks for taking a look at it.
User avatar
philwojo
Posts: 143
Joined: Mon Aug 26, 2013 4:22 pm

Re: How to change the colors of the Winning and Losing picks

Post by philwojo »

Ok, here is what you need to edit in the "weeklySchedule.asp" file:
Open your weeklySchedule.asp file in an editor and find the following:

Find this:

Code: Select all

			'Highlight the results.
			if result = vid then
				visitor = FormatWinner(visitor)
				vscore  = FormatWinner(vscore)		
			elseif result = rs.Fields("HomeID").Value then
				home   = FormatWinner(home)
				hscore = FormatWinner(hscore)
			end if
Replace it with this:

Code: Select all

			'Highlight the results.
			if result = vid then
				visitor = FormatWinner(visitor)
				vscore  = FormatWinner(vscore)
				home   = FormatIncorrectPick(home)
				hscore = (hscore)
				
			elseif result = rs.Fields("HomeID").Value then
				home   = FormatWinner(home)
				hscore = FormatWinner(hscore)
				visitor = FormatIncorrectPick(visitor)
				vscore  = (vscore)
			end if
That will do the weekly schedule, but you can also do the Weeklyentry.asp file as well. Not sure if you want this, but I noticed it was doing it there as well, so here is how to do that also.

Open your weeklyEntry.asp file:

Find this:

Code: Select all

'Highlight fields based on the game result.
			if games(i).result = games(i).visitorID then
				visitor = FormatWinner(visitor)
			elseif games(i).result = games(i).homeID then
				home = FormatWinner(home)
			elseif games(i).result = TIE_STR then
				tie = FormatWinner(TIE_STR)
			end if
Replace it with this:

Code: Select all

'Highlight fields based on the game result.
			if games(i).result = games(i).visitorID then
				visitor = FormatWinner(visitor)
				home = FormatIncorrectPick(home)
			elseif games(i).result = games(i).homeID then
				home = FormatWinner(home)
				visitor = FormatIncorrectPick(visitor)
			elseif games(i).result = TIE_STR then
				tie = FormatWinner(TIE_STR)
			end if
Hope that is what you were looking for.

Phil
e93octane
Posts: 5
Joined: Sun Aug 31, 2014 9:21 pm

Re: How to change the colors of the Winning and Losing picks on

Post by e93octane »

Got it... its working like a charm on both the weekly schedule and weekly entry !! Thanks for your help :)
sledge4
Posts: 28
Joined: Mon Aug 26, 2013 6:31 pm

Re: How to change the colors of the Winning and Losing picks on

Post by sledge4 »

I'm late to the party here, but I did all the updates noted in common.asp, yet I don't see these taking effect on the weeklyResults.asp page. Are there a different set of instructions for that page?
User avatar
philwojo
Posts: 143
Joined: Mon Aug 26, 2013 4:22 pm

Re: How to change the colors of the Winning and Losing picks on

Post by philwojo »

Yes see 2 posts above your last one there are separate edits to make that work.

Phil
User avatar
giz83
Posts: 3
Joined: Thu Jul 09, 2015 10:14 am

Re: How to change the colors of the Winning and Losing picks on

Post by giz83 »

Great edit. This really adds to the results pages. Thanks.
User avatar
philwojo
Posts: 143
Joined: Mon Aug 26, 2013 4:22 pm

Re: How to change the colors of the Winning and Losing picks on

Post by philwojo »

Glad you like it, I know my users have enjoyed that change, just makes things easier to look at with a quick glance.

Phil
P2W
Posts: 4
Joined: Wed Aug 17, 2022 7:27 am

Re: How to change the colors of the Winning and Losing picks on

Post by P2W »

Very nice. Thank you :D ซื้อบัตร Razer
messi999
Posts: 1
Joined: Wed Aug 17, 2022 8:39 am

Re: How to change the colors of the Winning and Losing picks on

Post by messi999 »

Very informative. Thank you.

P2W
Posts: 4
Joined: Wed Aug 17, 2022 7:27 am

Re: How to change the colors of the Winning and Losing picks on

Post by P2W »

Very informative. Thank you. ซื้อบัตร Razer
Post Reply