xoops forums

wishcraft

Module Developer
Posted on: 2010/3/22 5:26
wishcraft
wishcraft (Show more)
Module Developer
Posts: 3711
Since: 2007/5/18
#1

Sitemap for xPNEWS

I recently converted a php library from a chinese developer called PNEWS over to XOOPS for a NNTP reader.

I have been making a Free Usenet site with posting capabilities..

And using xpnews.. a module i wrote..

You can trial 1.2 if you want.. But this is a sitemap you can see and example at http://www.unseen.org.au/sitemap.php?server_id=1

<?php

require('mainfile.php');
global 
$xoopsDB;
error_reporting(0);
header('Content-type: text/xml');
$query[0] = "SELECT server_id, name from ".$xoopsDB->prefix('xpnews_servers')." WHERE server_id = '%s' limit 100";
$query[1] = "SELECT id, server_id, newsgroup, posts from ".$xoopsDB->prefix('xpnews_newsgroups')." where server_id = '%s' order by posts limit 4000 ";

?>
<?php

echo "<?xml version="1.0" encoding="UTF-8"?>n"?>
  <urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
   <url>
    <loc>http://<? echo $_SERVER['HTTP_HOST'];?>/</loc>
    <lastmod><? echo date('Y-m-d',time());?></lastmod>
    <changefreq>daily</changefreq>
    <priority>1</priority>
   </url>

<?php
   

    $rsTitle 
$xoopsDB->query(sprintf($query[0],intval($_GET['server_id']))) or die(mysql_error());
    
$totalRows_rsTitle mysql_num_rows($rsTitle);
    
    while (
$row mysql_fetch_assoc($rsTitle)){
    
?>
   <url>
    <loc>http://<? echo $_SERVER['HTTP_HOST'];?>/list,<? echo $row['server_id']; ?>,<? echo urlencode($row['name']); ?>.html</loc>
    <lastmod><? echo date('Y-m-d',time());?></lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.9</priority>
   </url>

<?php
   
    $rsTitleb 
$xoopsDB->query(sprintf($query[1], $row['server_id'])) or die(mysql_error());
    
$totalRows_rsTitle mysql_num_rows($rsTitleb);
    
    while (
$rowb mysql_fetch_assoc($rsTitleb)){

        for(
$r=20;$r<($rowb['posts']/20)+20;$r=$r+20){
    
?>
   <url>
    <loc>http://<? echo $_SERVER['HTTP_HOST'];?>/indexing,paginated,<? echo $row['server_id']; ?>,<? echo $rowb['newsgroup']; ?>,<? echo $r/20?></loc>
    <lastmod><? echo date('Y-m-d');?></lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.7</priority>
   </url>
<?php
        
}
    }
    }
   
?>   
</urlset>