Ana içeriğe atla

Tree Menu ( Sonsuz Derinlikte Menu )

PHP'de sonsuz derinlikte menü yapmak için düzgün bir tablo yapısı ve çok basit bir recursive fonksiyon yeterli. Tablo Yapısı CREATE TABLE `category` ( `sid` int(12) unsigned NOT NULL auto_increment, `module` set('estate','cars') collate utf8_bin NOT NULL, `parentId` int(6) NOT NULL, `title` varchar(255) collate utf8_bin NOT NULL, `isDefault` int(1) NOT NULL default '1', PRIMARY KEY (`sid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=14 ; INSERT INTO `category` VALUES (1, 0x657374617465, 0, 0x536174c4b16cc4b16b20456d6c616b, 1); INSERT INTO `category` VALUES (2, 0x657374617465, 1, 0x45766c6572, 1); INSERT INTO `category` VALUES (3, 0x657374617465, 1, 0xc4b0c59f7965726c657269, 1); INSERT INTO `category` VALUES (4, 0x657374617465, 1, 0x417273616c6172, 1); INSERT INTO `category` VALUES (5, 0x657374617465, 0, 0x4b6972616cc4b16b20456d6c616b, 1); INSERT INTO `category` VALUES (6, 0x657374617465, 5, 0x45766c6572, 1); INSERT INT...

Merkez Bankası Döviz Kuru Scripti

bugrakaan [at] gmail.com tarafından hazırlanmış ve daha önceden AdobeTurk sitesinde yayınlanmış olan scriptin tarafımdan geliştirilmiş/sadeleştirilmiş hali.

// php ile doviz kuru 
// e : bugrakaan [at] gmail.com
// edit : goktug.ozturk [at] hurbilisim.com
$currency = array( "USD" => "", "EUR" => "" );

$convert = array( "isim" => "I",
"forexbuying" => "A",
"forexselling" => "S",
);

$content = file_get_contents( "http://www.tcmb.gov.tr/kurlar/today.xml" );
echo $content;
foreach( $currency as $code => $arr )
{
preg_match( "'(.*)'Uis", $content, $crst );
foreach( $convert as $field => $value )
{
preg_match( "'<" . $field . ">(.*)'Uis", $crst[2], $frst );
$currency[$code][$value] = $frst[1];
}
}

echo "Dolar Alış : {$currency['USD']['A']}"
. "Dolar Satış : {$currency['USD']['S']}"
. "Euro Alış : {$currency['EUR']['A']}"
. "Euro Satış : {$currency['EUR']['S']}";

?>

Yorumlar

Bu blogdaki popüler yayınlar

Ajax Kütüphanesi

Geçtiğimiz yıl birden patlama yapan Ajax ve sitelere kazandırdığı dinamikliği çoğunuz farketmişsinizdir. Şu anda etrafta birçok Ajax kütüphanesi bulunuyor. Kendi hazırlamış olduğum ve uygulamalarımın hepsinde kullandığım kütüphaneyi sizinle paylaşmak istiyorum. Ajax.js Bu dosya tüm gerekli tanımlamaları ve fonksiyonları barındırmaktadır. Ajax fonksiyonlarını kullanacağınız bir sayfada bu dosyayı yüklemeniz gerekmektedir. var AjaxActive = false; var AjaxActions = new Array(); function AjaxPost() { this.Url = ''; this.Parameters = ''; this.Request = false; this.Result = ''; this.AjaxObject = ''; this.ResponseFunction = getResponse; this.OgeNo = ''; this.fStartAction = startAction; this.fGetResponse = getResponse; } function startAction( a, b, c ) { this.Url = a; this.Parameters = b; this.OgeNo = c; if ( window.XMLHttpRequest ) { // Mozilla, Safari,... this.Request = new XMLHttpRequest(); if ( this.Request.overrideMimeType ) thi...