Script Php XML Sitemaps Generator Tools

Silahkan diambil dan dipraktekkan Script Sitemap Generator Tools!

<?php
header("Content-type: text/xml");
// config
$filetxt = '50k-1.txt'; // lokasi file txt keyword
$namadomain = 'http://namadomain/tags/'; // isi dengan nama domain dan sesuaikan dengan permalink yang ente suka.
$priority = '0.5'; // nilai prioritas url dari 0.1 sampai 1 fungsi dan pengaruhnya saya nda tau :v

echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';

// function clean permalink
// sumber: http://cubiq.org/the-perfect-php-clean-url-generator
function cleanPermalink($str, $replace=array(), $delimiter='-') {
if( !empty($replace) ) {
$str = str_replace((array)$replace, ' ', $str);
}

$clean = iconv('UTF-8', 'ASCII//IGNORE', $str);
$clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean);
$clean = strtolower(trim($clean, '-'));
$clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean);

return $clean;
}

// proses baca isi file txt
$handle = fopen($filetxt, "r");
if ($handle) {
while (($line = fgets($handle)) !== false) {
echo
'<url>
<loc>'.$namadomain.cleanPermalink($line).'</loc>
<priority>'.$priority.'</priority>
</url>';
}
} else {
echo 'Apeeek.. error maning son!';
}
echo '</urlset>';
fclose($handle);
?>

Subscribe to receive free email updates:

0 Response to "Script Php XML Sitemaps Generator Tools"

Posting Komentar