Alternate Row Color Error

Discuss news styles, css code, and other Coranto customizations in here...the possibilities are endless, so have at it!

Moderator: Spunkmeyer

Alternate Row Color Error

Postby botkins » Thu Aug 04, 2005 7:15 pm

The code provided on the coranto website does not work. It only reads the first color and both. So instead of getting #ffffff and #e8e8e8 I only get #ffffff but when I put 3 colors it works but I need 2 colors to work.

Code: Select all
<PerlCode>
@OurColours = qw(#ffffff #e8e8e8);
$SwitchColour = $OurColours[($NextColour++ % @OurColours)];
</PerlCode>

<tr><td height="22" bgcolor="<Field: SwitchColour>"><font size="1" face="Verdana">- <a href="<MaginotURL: codes>"><Field: Subject></a></td></tr>


Thanks,
Scott
botkins
 
Posts: 15
Joined: Sat Jul 16, 2005 1:54 pm

Postby SomeGuyNamedJim » Fri Aug 05, 2005 2:42 am

Try
Code: Select all
<PerlCode>
@Colors = qw(#FF0000 #000000 #0000FF);
$ColorNum = $newsnum ? $ColorNum + 1 : 0;
${"AltColor_$Category"} = $Colors[($ColorNum % @Colors)];
$AltColor = ${"AltColor_$Category"};
</PerlCode>
SomeGuyNamedJim
 
Posts: 73
Joined: Thu Jan 20, 2005 3:12 am

Postby botkins » Fri Aug 05, 2005 4:21 am

I want to use 2 colors though not three, I tried your method and it worked but once I changed it to 2 colors it doesn't work.
botkins
 
Posts: 15
Joined: Sat Jul 16, 2005 1:54 pm

Re: Alternate Row Color Error

Postby Parahead » Fri Aug 05, 2005 8:37 am

Try:
Code: Select all
<PerlCode>
@OurColours = qw(#ffffff #e8e8e8);
$SwitchColour = $OurColours[($NextColour{$ProfileName}++ % @OurColours)];
</PerlCode>
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby thegametb » Tue Sep 06, 2005 1:47 am

If for some reason that code did not work, I would like to suggest using the code you did in the Help/FAQ section, Help > FAQ.

I'm in the middle of doing a site redesign and I was looking for a sports scheme for my headlines output file. The linked code does the job. I didn't retest the code discussed above in earlier posts in the dumbed down coding I did, but I don't want to screw up what works. My suggestion is just keep your coding for the headline simple (or as simple as you can do it) and it should work as long as you use the whole 6-digit string.
User avatar
thegametb
 
Posts: 109
Joined: Mon Jul 05, 2004 11:38 am

Postby Parahead » Tue Sep 06, 2005 6:39 am

For reference I post a link to this thread with a more in depth discussion of the switching code... :-)
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden


Return to Customization

Who is online

Users browsing this forum: No registered users and 3 guests

cron