I think it's a good idea to have parameter to exclude special tt_news categories from google sitemap. In addition I have created a diff file in which the parameter "excludeCat" passed as array. The array has the advantage that the individual category UIDs can be validated with intval. The diff file refers to the file class.tx_ddgooglesitemap_ttnews.php
--- class.tx_ddgooglesitemap_ttnews.php-rev33290.svn000.tmp.php Mi Mai 19 10:39:46 2010
+++ C:/Users/Christian/Desktop/dd_googlesitemap/trunk/class.tx_ddgooglesitemap_ttnews.php Sa Nov 24 21:46:36 2012
@@ -75,6 +75,13 @@
protected $isNewsSitemap;
/**
+ * Comma separated cat uid list
+ *
+ * @var string
+ */
+ protected $excludeCategory;
+
+ /**
* Single view page
*
* @var int
@@ -106,6 +113,16 @@
$this->isNewsSitemap = (t3lib_div::_GET('type') === 'news');
$rendererClass = ($this->isNewsSitemap ?
'tx_ddgooglesitemap_news_renderer' : 'tx_ddgooglesitemap_normal_renderer');
+
+ $excludeArray = t3lib_div::_GP('excludeCat');
+ if (is_array($excludeArray)) {
+ foreach ($excludeArray AS $excludeCat) {
+ $this->excludeCategory .= intval($excludeCat) . ',';
+ }
+ $this->excludeCategory = rtrim($this->excludeCategory, ',');
+ }
+ unset($excludeArray);
+
$this->renderer = t3lib_div::makeInstance($rendererClass);
}
@@ -120,11 +137,21 @@
if (count($this->pidList) > 0) {
t3lib_div::loadTCA('tt_news');
- $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,datetime,keywords',
- 'tt_news', 'pid IN (' . implode(',', $this->pidList) . ')' .
- ($this->isNewsSitemap ? ' AND crdate>=' . (time() - 48*60*60) : '') .
- $this->cObj->enableFields('tt_news'), '', 'datetime DESC'
- );
+
+ if (!empty($this->excludeCategory)) {
+ $res = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query('uid,title,datetime,keywords',
+ 'tt_news', 'tt_news_cat_mm', '', ' AND pid IN (' . implode(',', $this->pidList) . ')' .
+ ($this->isNewsSitemap ? ' AND crdate>=' . (time() - 48*60*60) : '') .
+ ' AND tt_news_cat_mm.uid_foreign NOT IN (' . $this->excludeCategory . ')' .
+ $this->cObj->enableFields('tt_news'), '', 'datetime DESC');
+ } else {
+ $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,title,datetime,keywords',
+ 'tt_news', 'pid IN (' . implode(',', $this->pidList) . ')' .
+ ($this->isNewsSitemap ? ' AND crdate>=' . (time() - 48*60*60) : '') .
+ $this->cObj->enableFields('tt_news'), '', 'datetime DESC'
+ );
+ }
+
$rowCount = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
while (false !== ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) {
if (($url = $this->getNewsItemUrl($row['uid']))) {