function create_items_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 items $lastId = 0; for ($page = 1; $page <= 50; $page++) { if ($page == 1) { $rows = \com\indigloo\sc\mysql\Post::getLatest(100, array()); } else { $start = $lastId; $direction = 'after'; $rows = \com\indigloo\sc\mysql\Post::getPaged($start, $direction, 100, array()); } foreach ($rows as $row) { $loc = "http://www.3mik.com/item/%s"; $loc = sprintf($loc, $row['pseudo_id']); $urlNode = $xmlDoc->addChild('url'); $urlNode->addChild('loc', $loc); $urlNode->addChild('lastmod', date('Y-m-d')); $lastId = $row['id']; } } $xmlString = $xmlDoc->asXML(); //write to file write_on_disk('sitemap_items.xml', $xmlString); }
function unfeature($postId) { mysql\Post::set_fp_bit($postId, 0); }