コード例 #1
0
ファイル: sitemap.php プロジェクト: rjha/sc
function create_groups_map($mysqli)
{
    $xml = '<?xml version="1.0" encoding="UTF-8"?> ';
    $xml .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">  </urlset>';
    $xmlDoc = new SimpleXMLElement($xml);
    //get 5000 latest groups
    $lastId = 0;
    for ($page = 1; $page <= 50; $page++) {
        if ($page == 1) {
            $rows = \com\indigloo\sc\mysql\Group::getLatest(100, array());
        } else {
            $start = $lastId;
            $direction = 'after';
            $rows = \com\indigloo\sc\mysql\Group::getPaged($start, $direction, 100, array());
        }
        foreach ($rows as $row) {
            $loc = "http://www.3mik.com/group/%s";
            $loc = sprintf($loc, $row['token']);
            $urlNode = $xmlDoc->addChild('url');
            $urlNode->addChild('loc', $loc);
            //last modified date is max(created_on,updated_on)
            $urlNode->addChild('lastmod', date('Y-m-d'));
            $lastId = $row['id'];
        }
    }
    $xmlString = $xmlDoc->asXML();
    write_on_disk('sitemap_groups.xml', $xmlString);
}
コード例 #2
0
ファイル: Group.php プロジェクト: rjha/sc
 function getPaged($paginator, $filters = array())
 {
     $limit = $paginator->getPageSize();
     if ($paginator->isHome()) {
         return $this->getLatest($limit, $filters);
     } else {
         $params = $paginator->getDBParams();
         $start = $params['start'];
         $direction = $params['direction'];
         $rows = mysql\Group::getPaged($start, $direction, $limit, $filters);
         return $rows;
     }
 }