View Single Post
  #37  
Old 01-02-2009, 12:27 AM
bergonzzi's Avatar
bergonzzi Offline
forum loafer
 
Join Date: Jan 2009
Location: Lisbon
Posts: 1
Hey there all,

Just like hessebub was asking I was also looking to generate a sitemap with clean URLs and I managed to modify the script to make it work. I'm also using the paged_archive addon with the mod_rewrite option ON. Here's the modified script:

PHP Code:
    $query mysql_query("SELECT id,datetime,headline FROM ".$pixelpost_db_prefix."pixelpost WHERE (datetime<='$cdate') ORDER BY datetime desc ");

    while(list(
$id,$datetime,$headline) = mysql_fetch_row($query))
    {
        
$image_title pullout($headline);
        
$seo_title '/'.converturl($image_title);
        
$datetime strtotime($datetime);
        
$datetime =date("Y-m-d",$datetime);
        
$output .= "
        <url>
        <loc>"
.$cfgrow['siteurl']."$id$seo_title</loc>
        <lastmod>$datetime</lastmod>
        </url>
        "
;
    }
     
$output .= "<url>
        <loc>"
.$cfgrow['siteurl']."about/</loc>
        </url>    
    </urlset>"
;
    
header("Content-type:application/xml");
    echo 
$mapheader.$output;
    exit;

So basically you ad the title field to the query (headline), add it to the while cycle as well ($headline) and then convert it to SEO friendly using the same functions used in paged_archive addon:
$image_title = pullout($headline);
$seo_title = '/'.converturl($image_title);
Finally, modify the generated output to make it clean:
<loc>".$cfgrow['siteurl']."$id$seo_title</loc>
You see it working o my blog: http://www.bergspot.com/sitemap.xml
__________________
My photoblog: http://www.bergspot.com/
Reply With Quote