All pastes #138689 Raw Edit

Mine

public text v1 · immutable
#138689 ·published 2006-08-19 12:55 UTC
rendered paste body
<?php


//SET 2 COLORS TO GRADIENT
$c1 = "FF8CC7";  //255, 153, 204  
$c2 = "FF0083";  //255, 0,   153

$cc[1] = hexdec(substr($c1,0,2));
$cc[2] = hexdec(substr($c1,2,2));
$cc[3] = hexdec(substr($c1,4,2));  // Convert #FFFFFF to FF FF FF to 255 255 255

//YOUR NAVIGATIONAL MENU [CAN BE MODIFIED FOR INMPORTING]
$links[0]="Send to a Friend";
$links[1]="&nbsp";
$links[2]="Join Our E-mail List";
$links[3]="&nbsp";
$links[4]="Hand Picked Products";
$links[5]="Most Popular";
$links[6]="Best Deals";
$links[7]="Our Ebay Store";
$links[8]="Clearance";
$links[9]="&nbsp";
$links[10]="Cats";
$links[11]="Dogs";
$links[12]="Fish";
$links[13]="Birds";
$links[14]="Wild Birds";
$links[15]="Reptile &amp; Amphibian";
$links[16]="Small Animal";
$links[17]="&nbsp";
$links[18]="Breeders";
$links[19]="&nbsp";
$links[20]="PetSmart";
$links[21]="1800-Pet-Meds";
$links[22]="Dr. Fosters &amp; Smith";
$links[23]="&nbsp";
$links[24]="Our Partners";
$links[25]="Link Exchange";
$links[26]="&nbsp";
$links[27]="About Us";
$links[28]="&nbsp";
$links[29]="Contact Us";


//GET COLOR INTERVALS AND GET COLOR ARRAY READY
list($intv1, $intv2, $intv3) = split('[,-]', gradient_getintv($c1,$c2,(count($links) / 2)));
$myarray = gradient_getcolors($links, $intv1, $intv2, $intv3, $cc);


//ECHO NAVIGATIONAL MENU WITH GRADIENT COLORS
echo '<ul style="list-style-type: none; font-family: verdana; font-size: 11px;">';

for($x=0; $x<=count($links); $x++) {
echo '<li><a href="' . $links[$x] . '" style="font-weight: bold; color: #' . $myarray[$x] . '">' . $links[$x] . '</a></li>';
}

echo '</ul>';

var_dump($myarray);

function gradient_getcolors($links, $intv1, $intv2, $intv3, $cc) {

//
//THIS FUNCTION CREATES THE COLOR ARRAY FOR LINK ECHOING
//

$count = 0;
for($x=0;$x<=(count($links)/2 - 1);$x++) {
$a1 = dechex($cc[1] - ($intv1 * $x));
$a2 = dechex($cc[2] - ($intv2 * $x));
$a3 = dechex($cc[3] - ($intv3 * $x));
$coray[$count] = $a1 . $a2 . $a3;
$count++;
}

for($x=$x - 1;$x>=0;$x--) {
$a1 = dechex($cc[1] - ($intv1 * $x));
$a2 = dechex($cc[2] - ($intv2 * $x));
$a3 = dechex($cc[3] - ($intv3 * $x));
$coray[$count] = $a1 . $a2 . $a3;
$count++;

}
echo "COUNT: " . count($coray) . "<br>";
return $coray;

}



function gradient_getintv($c11, $c22, $intv) {

//
//THIS FUNCTION RETURNS THE DIFFERENCE BETWEEN 2 COLORS R,G,B 
//

$c1[1] = hexdec(substr($c11,0,2));
$c1[2] = hexdec(substr($c11,2,2));
$c1[3] = hexdec(substr($c11,4,2));  // Convert #FFFFFF to FF FF FF to 255 255 255

$c2[1] = hexdec(substr($c22,0,2));
$c2[2] = hexdec(substr($c22,2,2));
$c2[3] = hexdec(substr($c22,4,2));  // Convert #FF0000 to FF 00 00 to 255 0 0 

$d1[0] = $c1[1] - $c2[1];
$d2[0] = $c1[2] - $c2[2];
$d3[0] = $c1[3] - $c2[3];   //Gets the Difference
$d[0] = $d1[0] . $d2[0] . $d3[0];    //0, 153, 51
//echo "d[0] = " . $d[0] . "<br>";

$d1[1] = $d1[0] / $intv;
$d2[1] = $d2[0] / $intv;
$d3[1] = $d3[0] / $intv;  //Divides the Difference By the intervals  0, 10.2. 3.4
$d[1] = $d1[1] . "," . $d2[1] . "," . $d3[1];   
//echo "d[1] = " . $d[1] . "<br>";

//echo $d1[1] . '<br>';
//echo $d2[1] . '<br>';
//echo $d3[1] . '<br>';  //individual node value  0 42.5 42.5

return $d[1];

}


?>