Login   Register  
PHP Classes
elePHPant
Icontem

AlternarColor array iterator: Loop an array endlesly, returns current element

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2005-08-09 (9 years ago) RSS 2.0 feedNot enough user ratingsTotal: 441 All time: 5,665 This week: 1,809Up
Version License Categories  
alternarcolor 1.0GNU General Public Lice...Graphics
Description Author  

This is a very simple class that iterates over a set (of color codes or names maybe?) and returns the next element in the set on each iteration, coming to first element again.

It can be useful for generating listings with rows using alternated colors.

The class can take an array with an arbitrary number of colors names or values.

In the first iteration it returns the first color in the array. In the next iteration it returns the following color, and so on. When the end or the array is reached, it returns the first color again.

The comments in the class are in Spanish.

Atributes
+---- colores // Available Colors
+---- color // Actual color

Methods
+---- alternarColor( array("color1",...,"colorN") ) // Constructor
+---- imprimir () // Prints out value

Picture of Alfredo Rahn
Name: Alfredo Rahn <contact>
Classes: 4 packages by
Country: Venezuela Venezuela
Age: 40
All time rank: 9062 in Venezuela Venezuela
Week rank: 1754 Down5 in Venezuela Venezuela Down

  Files folder image Files  
File Role Description
Accessible without login Plain text file alternarColor.php Class This is the main class
Plain text file example.php Example Example illustrating use of the class

 Version Control Unique User Downloads Download Rankings  
 0%Total:441All time:5,665
 This week:0This week:1,809Up
 User Comments (1)  
 
Very original idea.
6 years ago (Axel C)
67%StarStarStarStar