• 25-08-2012, 15:46:04
    #28
    Mepring çok teşekkür ederim hocam emeklerine
  • 04-11-2012, 04:54:57
    #29
    alttaki gibi olmalı.
    <?php
    @session_start ();
    @error_reporting ( E_ALL ^ E_NOTICE );
    @ini_set ( 'display_errors', true );
    @ini_set ( 'html_errors', false );
    @ini_set ( 'error_reporting', E_ALL ^ E_NOTICE );
    
    define ( 'WEBOLYE', true );
    
    define ( 'ROOT_DIR', dirname ( __FILE__ ) );
    define ( 'SYSTEM_DIR', ROOT_DIR . '/system' );
    
    require_once SYSTEM_DIR. '/boot.php';
    
    $FILE = fopen ('sitemaps/sitemap.xml', "w");
    $text='<?xml version="1.0" encoding="UTF-8"?>';
    $text.='<urlset
    xmlns="http://www.google.com/schemas/sitemap/0.84"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
    http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">';
    
    
    $puan = array(
    	1 => '0.5',
    	2 => '0.6',
    	3 => '0.6',
    	4 => '0.7',
    	5 => '0.7',
    	6 => '0.8',
    
    	);
    
    $i = 0;
    $db->query("SELECT * FROM soz_basliklar order by id desc");
    while($row = $db->get_row()) {
    	$i++;
    	$row['isim'] = mb_strtolower($row['isim'],"UTF-8");
    	$baslik = $link = ereg_replace(" ","+",$row['isim']);
    	if($row['sontarih'] == '0000-00-00 00:00:00') {
    		$tarih = strftime("%Y-%m-%d", strtotime($row['tarih']));
    
    	}else{
    		$tarih = strftime("%Y-%m-%d", strtotime($row['sontarih']));
    	}
    
    	$text.=addURL('http://www.site.com/t/'.$baslik,$puan[$i],$tarih);
    if($i == 5) { $i = 0; }
    }
    
    
    $text.='</urlset>';
    fwrite ($FILE, $text);
    fclose ($FILE);
    
    function addURL($url='http://www.site.com/',$priority='0.5',$tarih) {
    	$code='
    <url>
    	<loc>'.$url.'</loc>
    	<priority>'.$priority.'</priority>
    	<lastmod>'.$tarih.'</lastmod>
    </url>';
    	return $code;
    }
    ?>