<?php
function b_sitemap_takarizm(){
	$xoopsDB = Database::getInstance();

	global $sitemap_configs;
	$myts =& MyTextSanitizer::getInstance();

	$sitemap = array();
	$sql = "select `topic_id`,`topic_title` FROM `" . $xoopsDB -> prefix( 'takarizm_topics' ) . "` order by topic_id asc" ;
	$result = $xoopsDB->query($sql);
	$i = 0;
	while (list($catid, $name) = $xoopsDB->fetchRow($result)){
		// �Ƥν���
		$sitemap['parent'][$i]['id'] = $catid;
		$sitemap['parent'][$i]['title'] = $myts->makeTboxData4Show( $name ) ;
		$sitemap['parent'][$i]['url'] = "index.php&amp;storytopic=$catid";
		$sql = "select `storyid`, `title` ,`published` FROM `" . $xoopsDB -> prefix( 'takarizm_stories' ) . "` where topicid=$catid order by published desc" ;
		$result2 = $xoopsDB->query($sql,10);
		$j = 0;
		while (list($catid2, $name2, $date2) = $xoopsDB->fetchRow($result2)){
				$count = 1; // MEMO prefix��Ĺ���ǥ��֥��Ƥο�����Ƚ�ꤷ�Ƥ�
				$mydate = "(" . formatTimestamp($date2,'Y-m-d') . ")";
				$sitemap['parent'][$i]['child'][$j]['id'] = $catid2;
				$sitemap['parent'][$i]['child'][$j]['title'] = $myts->makeTboxData4Show( $name2 .  $mydate) ;
				$sitemap['parent'][$i]['child'][$j]['image'] = 3;
				$sitemap['parent'][$i]['child'][$j]['url'] = "index.php?page=article&amp;storyid=$catid2";
				$j++;
		}
		$i++;
	}
	return $sitemap;

}
?>
