Topic: Making Dynamic Sitemap Play nice with dated folders
you will need to have the admin panel installed for this to be easy
what your going to to need to do is edit the sitemap.php file given by the original creator and change it with this.
<?php
require ('admin/config.php');
require ('admin/db_connect.php');
$req = mysql_query("SELECT * FROM pics ORDER BY uid");
$r= mysql_fetch_assoc($req);
$DIR = "/upload/";
$directorio=opendir(".".$DIR);
while ($archivo = readdir($directorio)){
If(getimagesize(".".$DIR.$archivo)!= 0){
$lista[] = "http://". $_SERVER['SERVER_NAME'] . $DIR . $archivo;
}
}
closedir($directorio);
header ("Content-type: text/xml");
echo('
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
');
foreach($lista as $imagen){
while ($r=mysql_fetch_assoc($req)) {
echo("<url>");
echo("<loc>". $conf["site_url"] . "upload" . "/" . $thumb=date("Y",$r['created']) . "/" . $thumb=date("M",$r['created']) . "/" . $thumb=date("d",$r['created']) . "/" . $r['uniqid'] . "</loc>");
echo("</url>");
}
}
echo("</urlset>");
?>a demo of this is at http://www.imgcrave.com/sitemap.php
keep in mind this only displays images that have been uploaded sense the admin panel was installed.
be sure to change the $DIR Varable to match where your images are uploaded.
Last edited by th3fallen (2010-12-09 15:09:44)
