When using a news extension like timtab in typo3 to publish your articles, you usually create XML feeds for different formats like RSS2.0, Atom0.3, etc.
But what if you would like to have separate feeds for different posting categories? In this article I will show you how to do this.
The solution constists of two parts:
When enabling a news feed in the template setup of your blog, you normally use something like this:
## This enables the xml news feed
xmlnews = PAGE
xmlnews {
typeNum = 100
## insert your configuration here
}
To add a new feed for a category you simply add the following code:
## define feeds per category
## category tools
xmlnews_tools < xmlnews
xmlnews_tools.typeNum = 101
xmlnews_tools.10.categoryMode = 1
xmlnews_tools.10.categorySelection = <id of the "tools" category>
xmlnews_tools.10.displayXML.xmlTitle = <name of your blog> - tools
xmlnews_tools.10.displayXML.xmlLink = <your blog URL>
xmlnews_tools.10.displayXML.xmlDesc = <description of your blog> - tools
This example creates a new feed for the category "tools" using a new page type "101". You can nearly use any number here, but remember it for the second part ;)
I don't do an in depth description of each code line here. If you have any questions, just .
After defining the new category feed(s), we should beautify them using RealURL. Although, if you like using the raw page types, you can use them already by calling:
<your blog URL>?type=101
Remember the page type we defined in part 1 -> "101".
But hey, wouldn't it be nice, if we could use URLs like:
<your blog URL>/rss_tools.xml
OK, let's see how we do this:
You have to modify your RealURL section in localconf.php located in the typo3conf directory on your typo3 server. In this file locate your RealURL section:
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
'_DEFAULT' => array(
// configure filenames for different page types
'fileName' => array(
'index' => array(
// main feed
'rss.xml' => array(
'keyValues' => array(
'type' => 100,
),
),
// feed for category "tools"
'rss_tools.xml' => array(
'keyValues' => array(
'type' => 101,
),
),
'index.htm' => array(
'keyValues' => array(),
),
),
'defaultToHTMLsuffixOnPrev' => 1,
),
),
);
You see, that the main feed is defined using the page type 100. The file name "rss.xml" is assigned to this page type, so you can either call the feed using "?type=100" or using "rss.xml".
The same definition is used for defining our new page type 101.