Anda di halaman 1dari 1

<?

php
if ($no =='')
{
$sitemap_file = 0;
}
else
{$sitemap_file = $no;
} $xml = '';
$xml .= '
$xml .= ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"';
$xml .= ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"';
$xml .= '
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9';
$xml .= ' http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">';
include('koneksi.php'); // sesuaikan dengan koneksi databeses Anda
$query = Mysql_query("select * from tbl_artikel_anda order by id"); //
sesuaikan dengan tabel artikel Anda
$numrows = mysql_num_rows($query);
if (empty($offset))
{
$offset = $no;
}
$limit =1000; // jumlah url dalam 1 file sitemap ¼br> $query =
mysql_query("select * from tbl_artikel_anda order by id limit $no,
$limit"); // sesuaikan dengan tabel artikel Anda
while ($data=Mysql_fetch_array($query)) ¼br> {
$xml .= '';
$xml .= ' http://www.alamatweb.com/'. $data[urlfile] .''; // sesuaikan
dengan tabel artikel Anda
$xml .= ' 0.5';
$xml .= ' '.date("Y");.'-'.date("m-d");.'';
$xml .= ' daily';
$xml .= '';
}
mysql_close();
$xml .= '';
$a = fopen('sitemap_'.$sitemap_file.'.xml',"w");
fputs($a, $xml);
fclose($a);
?>