assign("page_title", comp_name." Sitemap"); $smarty->assign("head_meta_desc", "Look around ".comp_name." online shop for unique handmade clay and ceramic gifts"); $smarty->assign("head_meta_keywords", "unique handmade clay and ceramic gifts, hand made jewellery"); $smarty->assign("head_canonical", site_url_full.static_sitemap); //***************************** CMS ************************************ if (sys_use_cms == true) { //pull cms pages from db $cms_pages = get_pages_array('', true, 2); } // static pages needs coding properly - refer to xml sitemap /*if (defined('sitemap_static_pages')) { $array = array(); $array = unserialize(sitemap_static_pages); $start = count($array)+1; // For each CMS page $query = "SELECT filename,navtitle FROM ".tbl_cms." WHERE id!=".cms_index_page; // cms pages except homepage which will be index.php $result = return_result($query); if (mysql_num_rows($result) > 0) { while($row = mysql_fetch_array($result, MYSQL_BOTH)) { $array[$start][0] = site_url_full.stripslashes($row['filename']); $array[$start][3] = t($row['navtitle']); $start++; } } $array[$start][0] = site_url_full.shop_cat_page."?".shop_cat_new_var."=1"; $array[$start][3] = "New Products"; $start++; }*/ /* cat date query SELECT DISTINCT(catdates.pageid), GREATEST(proddates.LastModified,catdates.LastModified) AS LastModified from (SELECT p.catid as catid,MAX(p.updated) AS LastModified FROM products p GROUP BY p.id,p.catid) proddates INNER JOIN (SELECT c.id AS catid,c.pageid,MAX(c.updated) AS LastModified FROM categories c WHERE c.hide=0 GROUP BY c.id,c.pageid) catdates ON proddates.catid=catdates.catid */ $catarray = array(); $start = 0; /*foreach(get_cat_array() as $catid => $cat) { $catarray[$start][0] = site_url_full.shop_cat_page."?".shop_cat_var."=".force_numeric($catid); $catarray[$start][3] = t($cat); $start++; } */ // supplier $suparray = array(); $start = 0; $current_sup=''; $suppliers_query = "SELECT ".tbl_suppliers.".pageid, ".tbl_suppliers.".name, ".tbl_suppliers.".id FROM ".tbl_suppliers.",".tbl_products." WHERE ".tbl_suppliers.".id=".tbl_products.".supplier AND ".tbl_products.".hide='0' AND ".tbl_products.".archived !='1'"; $suppliers_result = return_result($suppliers_query); if ($suppliers_result != false && mysql_num_rows($suppliers_result) > 0) { while($suppliers_row = mysql_fetch_array($suppliers_result, MYSQL_BOTH)) { if($current_sup!=$suppliers_row['pageid']) { $suparray[$start][0] = site_url_full.shop_suppliers_page."?".shop_suppliers_var."=".$suppliers_row['pageid']; $suparray[$start][3] = t($suppliers_row['name']); $start++; } $current_sup=$suppliers_row['pageid']; } } // items $itemsarray = array(); $start = 0; /*$query = "SELECT id, title, pageid FROM ".tbl_products." WHERE hide='0' AND archived !='1'"; $result = return_result($query); if (mysql_num_rows($result) > 0) { while($row = mysql_fetch_array($result, MYSQL_BOTH)) { $itemsarray[$start][0] = site_url_full.shop_prod_page."?".shop_prod_var."=".$row['pageid']; $itemsarray[$start][3] = t($row['title']); $start++; } }*/ /** News cats */ if (sys_use_news == true) { $news_cats = unserialize(news_cats); $start = 0; $newsarray = array(); foreach ($news_cats as $key => $value) { $newsquery = "SELECT * FROM ". tbl_news ." WHERE hide != '1' AND catid='". $key ."' ORDER BY sortdate DESC"; $newsresult = return_result($newsquery); if ($newsresult != false && mysql_num_rows($newsresult) > 0) { $newsarray[$key]['title'] = $value['news_title']; while($newsrow = mysql_fetch_array($newsresult, MYSQL_BOTH)) { //$newsarray[$key]['articles'][$start]['url'] = site_url_full . $value['article_page'] . "?" . $value['url_var']."=".$newsrow['pageid']; $newsarray[$key]['articles'][$start]['url'] = site_url_full.$news_cats[$newsrow['catid']]["article_slug"]."/".$newsrow['pageid']; $newsarray[$key]['articles'][$start]['title'] = t($newsrow['title']); $start++; } } } } //$smarty->assign("array", $array); $smarty->assign("cms_pages", $cms_pages); $smarty->assign("catarray", $catarray); $smarty->assign("suparray", $suparray); $smarty->assign("itemsarray", $itemsarray); $smarty->assign("newsarray", $newsarray); $smarty->display('sitemap.tpl'); ?>