<?php class Bloklar{ var $renk; var $tarih; var $yazi; function renksec($renk){ $this->renk = $renk; } function tarihsec($tarih){ $this->tarih = $tarih; } function yazisec($yazi){ $this->yazi = $yazi; } function renkgetir(){ return $this->renk; } function tarihgetir(){ return $this->tarih; } function yazigetir(){ return $this->yazi; } function Bloklar(){ $Bloklar = "<table class='$this->renk' width='200' cellspacing='0'> <tr><td class='tarih'>$this->tarih</td></tr> <tr><td>$this->yazi</td></tr></table>"; return $Bloklar; } } ?> <STYLE type="text/css"> .sari{border: 1px dotted #C0C0C0;background-color: #FFFFCC;font-size:9pt;} .sari01{border: 1px dotted #C0C0C0;background-color: #FFEEAB;font-size:9pt;} .mavi{border:1px dotted #C0C0C0;background-color: #E7F2FF;font-size:9pt;} .mavi01{border:1px;solid #0cf;background-color: #E7F2FF;font-size:9pt;} .tarih{border: 1px dotted #C0C0C0;background-color: #FFFFFF;font-size:9pt;} </STYLE> <?php $bloklarim = new Bloklar; $bloklarim->renksec("mavi"); $bloklarim->tarihsec("09.06.2018 05:47:57"); $bloklarim->yazisec("test"); echo $bloklarim->Bloklar(); $bloklarim = new Bloklar; $bloklarim->renksec("sari"); $bloklarim->tarihsec("09.06.2018 05:47:57"); $bloklarim->yazisec("test"); echo $bloklarim->Bloklar(); $bloklarim = new Bloklar; $bloklarim->renksec("mavi01"); $bloklarim->tarihsec("09.06.2018 05:47:57"); $bloklarim->yazisec("test"); echo $bloklarim->Bloklar(); $bloklarim = new Bloklar; $bloklarim->renksec("sari01"); $bloklarim->tarihsec("09.06.2018 05:47:57"); $bloklarim->yazisec("test"); echo $bloklarim->Bloklar(); ?>
Çıktısı
<STYLE type="text/css"> .sari{border: 1px dotted #C0C0C0;background-color: #FFFFCC;font-size:9pt;} .sari01{border: 1px dotted #C0C0C0;background-color: #FFEEAB;font-size:9pt;} .mavi{border:1px dotted #C0C0C0;background-color: #E7F2FF;font-size:9pt;} .mavi01{border:1px;solid #0cf;background-color: #E7F2FF;font-size:9pt;} .tarih{border: 1px dotted #C0C0C0;background-color: #FFFFFF;font-size:9pt;} </STYLE> <table class='mavi' width='200' cellspacing='0'> <tr><td class='tarih'>09.06.2018 05:47:57</td></tr> <tr><td>test</td></tr></table><table class='sari' width='200' cellspacing='0'> <tr><td class='tarih'>09.06.2018 05:47:57</td></tr> <tr><td>test</td></tr></table><table class='mavi01' width='200' cellspacing='0'> <tr><td class='tarih'>09.06.2018 05:47:57</td></tr> <tr><td>test</td></tr></table><table class='sari01' width='200' cellspacing='0'> <tr><td class='tarih'>09.06.2018 05:47:57</td></tr> <tr><td>test</td></tr></table>