Asa, PM-ul de la Daniel.
Public
Nu imi place politica secretomaniei
PHP Code:
pasul 1: faceti un nou fisier sub domeniul vostru
pasul 2: setati content type la acel fisier text/xml si ii setati no cache
pasul 3: generati structura xml
(structura xml trebuie sa fie conforma cu schema prezentata aici PHP Code:
Exemplu de cod (php)
a) declaratii header
PHP Code:
header("Pragma: public");
header("Expires: 0");
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header("Content-Type: text/xml");
b) generare sitemap
PHP Code:
//afisam paginile statice (cele care nu pot fi generate din baza de date)
echo "<?xml version="1.0\" encoding=\"UTF-8\"?>
<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\">
<url><loc>http://www.my_website.com</loc></url>
<url><loc>http://www.my_website.com/</loc></url>
<url><loc>http://www.my_website.com/index.php</loc></url>
";
PHP Code:
//afisare continut (simple)
$rsx = mysql_query ("Select * from table_name where condition='value' order by name desc");
while ($rowx=mysql_fetch_object($rsx)){
echo "<url><loc>";
echo "url here";
echo "</loc></url>";
}
PHP Code:
Cum va arata un sitemap generat (varianta un pic mai completa)echo "</urlset>";
HTML Code:
<urlset>
<url>
<loc>http://www.my_website.com</loc>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>http://www.my_website.com/index.htm</loc>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
</urlset>
Cam asta ar fi.
Daca sunt si alte intrebari ... shoot![]()





Răspunde cu citat