Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Sitemap generator - generowanie mapy strony, sitemap.xml sitemap-index.xml
korro
post
Post #1





Grupa: Zarejestrowani
Postów: 259
Pomógł: 42
Dołączył: 8.04.2005
Skąd: Mława

Ostrzeżenie: (0%)
-----


Witam.

Przedstawiam klasę PHP generującą mapy stron zgodne z protokołem Sitemap 0.90.
Założeniem była 100% zgodność ze specyfikacją oraz maksymalna możliwa prostota.

Cechy klasy:
  • Pełna zgodność z UTF-8
  • Wsparcie dla Sitemap index
  • Obsługa do 50,000,000 linków
  • Wsparcie dla plików robots.txt
  • Automatyczne powiadamianie wyszukiwarek: Google, Yahoo!, Ask i Bling
  • Wsparcie dla Yahoo App ID
  • Wsparcie dla GZip

Przykład wygenerowanej mapy:

http://wydluz.net/sitemap.xml


Download i przykłady użycia w języku angielskim:

http://www.phpclasses.org/browse/package/5838.html


Przykłady użycia i opis w języku polskim:

http://antczak.org/2009/12/sitemap-generat...ie-mapy-strony/


Ten post edytował korro 11.12.2009, 10:15:04
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
koderrr
post
Post #2





Grupa: Zarejestrowani
Postów: 255
Pomógł: 16
Dołączył: 4.07.2007

Ostrzeżenie: (0%)
-----


Postanowilem napisac cos podobnego
ale troche latwiejszego w uzyciu dla mniej doswiadczonych userow

  1. <?php
  2.  
  3. if($_GET['hash'] != nasztajnykod)
  4. {
  5. }
  6.  
  7. $when = date('Y-m-d');
  8. $sitemap = 'sitemap.txt';
  9. $tmp = 'temporary.txt';
  10. $logs = 'logs.txt';
  11. //nasza domena
  12. $website = file_get_contents('http://www.xml-sitemaps.com/download/www.domain.com/urllist.txt');
  13.  
  14.  
  15. if($website != true)
  16. {
  17. $error = $when;
  18. $error .= "\t";
  19. $error .= "Address not available from this machine \r\n";
  20. file_put_contents($logs, $error, FILE_APPEND);
  21. }
  22.  
  23. $write = file_put_contents($tmp, $website);
  24.  
  25. if(filesize($sitemap) == filesize($tmp))
  26. {
  27. $error = $when;
  28. $error .= "\t";
  29. $error .= "Sitemap file has not changed \r\n";
  30. file_put_contents($logs, $error, FILE_APPEND);
  31. }
  32.  
  33. // pingujemy strone google
  34. $pinggoogle = file_get_contents('http://www.google.com/webmasters/tools/ping?sitemap=http://www.domain.com/sitemap.txt');
  35.  
  36. if ($pinggoogle != true)
  37. {
  38. $error = $when;
  39. $error .= "\t";
  40. $error .= "Google is not responding (sic!) \r\n";
  41. file_put_contents($logs, $error, FILE_APPEND);
  42. }
  43. else
  44. {
  45. $error = $when;
  46. $error .= "\t";
  47. $error .= "Sitemap has been successfully added \r\n";
  48. file_put_contents($logs, $error, FILE_APPEND);
  49.  
  50. $write = file_put_contents($sitemap, $website);
  51. }
  52. ?>
  53.  
  54.  
  55.  


dodalem logowanie ew bledow co moze sie przydac gdy wrzucimy calosc do crona
calosc jest prosta i dziala
moze sie komus przyda
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 16.10.2025 - 02:35