• Welcome to the Chevereto User Community!

    Here, users from all over the world come together to learn, share, and collaborate on everything related to Chevereto. It's a place to exchange ideas, ask questions, and help improve the software.

    Please keep in mind:

    • This community is user-driven. Always be polite and respectful to others.
    • Support development by purchasing a Chevereto license, which also gives you priority support.
    • Go further by joining the Community Subscription for even faster response times and to help sustain this space

Making Dynamic Sitemap Play nice with dated folders

th3fallen

Chevereto Noob
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.


Code:
<?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.
 
Back
Top