TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 11-24-2008, 07:56 PM   #1 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Terminal Alternate Table Row Colours

I had a rethink and came up with the following set of classes to easily handle alternate row colours in tables and elsewhere. The index file will explain everything clearly. You essentially create your own sub-classes that extend the base class, and then call the method.

You can easily add more than two colours. It will then cycle through them all and reset. You may also manually reset for if you need the same alternate row colour template more than once on the same page load.

php Code:
/* Get the first colour from the template Summer Sunshine as a normal class string */
echo $pRowColours->getSummerSunshine();

/* Get the first colour from the template Grey Scale with "background-color" appended for use in style attributes */
echo $pRowColours->getGreyScaleAsStyle();

/* Reset the template Psychedelic to pointer 0 so the next call will get the first colour again. */
$pRowColours->resetPsychedelic();
Attached Files
File Type: rar TalkPHP_RowColours.rar (1.9 KB, 30 views)
File Type: zip TalkPHP_RowColours.zip (2.2 KB, 16 views)
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
The Following User Says Thank You to Wildhoney For This Useful Post:
hello-world (02-18-2009)
Old 11-24-2008, 10:29 PM   #2 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Four classes for rotating background colours in HTML tables/lists? Crazy. Oh and can you not keep zipping up the code snippets (or at least provide an online-viewable version) since downloading just to scan some code seems an awful waste of time and clicks.

(Sorry for being a negative nancy! )
Salathe is offline  
Reply With Quote
Old 11-25-2008, 02:44 AM   #3 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Yes, I was taking into consideration any modifications that people may wish to make. Such as setting alternate font colours, alternate borders, etcetera.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 09:53 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design