Bir rss feed oluşturucu için bir kod derledim fakat verileri çekemiyorum db bağlantısını yaptığım halde içerikler gelmiyor doğru tablodan doğru verileri çekiyorum ama yok veriler gelmiyor kafayı yemek üzereyim .. Üstadlar bi bakabilirse çok sevinirim...
<?php
header('Content-type: text/xml'); ?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<?php
$servername = "localhost";
$username = "--";
$password = "--";
$dbname = "--";
$site = $_SERVER["HTTP_HOST"];
$tarih=date("Y-m-d");
function seo($url){
$url = trim($url);
$url = strtolower($url);
$find = array('<b>', '</b>');
$url = str_replace ($find, '', $url);
$url = preg_replace('/<(\/{0,1})img(.*?)(\/{0,1})\>/', 'image', $url);
$find = array(' ', '"', '&', '&', '\r\n', '\n', '/', '\\', '+', '<', '>');
$url = str_replace ($find, '-', $url);
$find = array('é', 'è', 'ë', 'ê', 'É', 'È', 'Ë', 'Ê');
$url = str_replace ($find, 'e', $url);
$find = array('í', 'ı', 'ì', 'î', 'ï', 'I', 'İ', 'Í', 'Ì', 'Î', 'Ï');
$url = str_replace ($find, 'i', $url);
$find = array('ó', 'ö', 'Ö', 'ò', 'ô', 'Ó', 'Ò', 'Ô');
$url = str_replace ($find, 'o', $url);
$find = array('á', 'ä', 'â', 'à', 'â', 'Ä', 'Â', 'Á', 'À', 'Â');
$url = str_replace ($find, 'a', $url);
$find = array('ú', 'ü', 'Ü', 'ù', 'û', 'Ú', 'Ù', 'Û');
$url = str_replace ($find, 'u', $url);
$find = array('ç', 'Ç');
$url = str_replace ($find, 'c', $url);
$find = array('ş', 'Ş');
$url = str_replace ($find, 's', $url);
$find = array('ğ', 'Ğ');
$url = str_replace ($find, 'g', $url);
$find = array('/[^a-z0-9\-<>]/', '/[\-]+/', '/<[^>]*>/');
$repl = array('', '-', '');
$url = preg_replace ($find, $repl, $url);
$url = str_replace ('--', '-', $url);
return $url;
}
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
mysqli_set_charset($conn,'utf8');
?>
<channel>
<title>Site Başlığı</title>
<description>Site Açıklama</description>
<link><?php echo URL ?></link>
<language>tr</language>
<?php
$rssSql = query('SELECT * FROM news ORDER BY id DESC LIMIT 20');
while($icerik = row($rssSql)) { ?>
<item>
<title><?php echo $icerik['page_title'] ?></title>
<image>
<url><?php echo URL.'/img/'.$icerik['foto'] ?></url>
</image>
<link><?php echo URL,$icerik['news_name'] ?></link>
<pubDate><?php echo formatZaman($icerik['$tarih']) ?></pubDate>
<description><?php echo $icerik['page_description'] ?></description>
<language>tr</language>
<guid isPermaLink="true"><?php echo URL,$icerik['news_name'] ?></guid>
</item>
<?php
}
?>
<?php
$conn->close();
?>
</channel>
</rss>