Açılır Pencere Sınıfı

<?php
class PencereAdres{
	var $adres = "https://www.ulusanyazilim.com";
	var $resim = "";
	var $ipucu = "";
	var $aciklama = "Ulusan Yazılım";
	var $araccubugu = "no";
	var $kaydirmacubugu = "no";
	var $genislik = 500;
	var $yukseklik = 300;
	var $sol = 200;
	var $ust = 200;
	var $parametre = "";		// açılır pencereye extra parametre göndermek için
	var $pencerestili = 0;
	function goster(){
		if($this->pencerestili == 0){
			echo "<a href='#' onClick=\"window.open('".$this->adres.$this->parametre."','','toolbar=".$this->araccubugu.",scrollbars=".$this->kaydirmacubugu.",width=".$this->genislik.",height=".$this->yukseklik.",left=".$this->sol.",top=".$this->ust."')\">";
		}elseif($this->pencerestili == 1){
			echo "<a href='".$this->adres.$this->parametre."' target='_blank'>"; 
		}
		echo $this->aciklama;
		if ($this->resim != ""){
			echo"<img src='".$this->resim."' ";
			if ($this->ipucu != "") echo"title='".$this->ipucu."' ";
			echo"border=0>";
		}
		echo"</a>";
	}
}
$w=new PencereAdres;
$w->goster();
?>

Çıktısı öne çıkan görseldeki gibidir.

Rastgele Link Rengi Üretmek

Her linkin rengi farklı olsun dedik. Arkaplanı da buna zıt olarak belirledik. Buyrun kodlar:

<?php
echo '<'.'style type="text/css"'.'>';
function rengi_ters_cevir($color){
    $color = str_replace('#', '', $color);
    if (strlen($color) != 6){ return '000000'; }
    $rgb = '';
    for ($x=0;$x<3;$x++){
        $c = 255 - hexdec(substr($color,(2*$x),2));
        $c = ($c < 0) ? 0 : dechex($c);
        $rgb .= (strlen($c) < 2) ? '0'.$c : $c;
    }
    return '#'.$rgb;
}
$ToplamLinkSayisi=3;
for($x=1;$x<$ToplamLinkSayisi+1;$x++){
	$colorno=rand(0,10000000);
	$bgno=10000000-$colorno;
	echo 'a:nth-child('.$x.'n){';
	echo 'color: #'.strtoupper(dechex($colorno)).';';
	echo 'background-color: '.rengi_ters_cevir('#'.strtoupper(dechex($colorno))).';';
	echo '}
	';
}
echo '<'.'/style'.'>';
echo '<a href="#1">1.Link</a>';
echo '<a href="#2">2.Link</a>';
echo '<a href="#3">3.Link</a>';
?>