• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

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