Hallo zusammen!
Für einen kleinen AJAX-Ticker mit den letzten Forenbeiträgen hab ich eine RSS-Ausgabe des mm_forum benötigt. Die RSS-Ausgabe ist weitgehendst analog zur "Neueste Beiträge" Ansicht, beinhaltet jedoch auch auszugsweise den Beitragstext in Plain und HTML.
Nachfolgend eine kurze Schilderung welche Änderungen notwendig sind.
Vielleicht lässt sich das ja auch langfristig ins Forum integrieren ... ;-)
In der class.tx_mmforum_pi1.php nach der Funktion list_latest, die Funktion list_latest_rss() einbauen:
function list_latest_rss() { $conf = $this->conf; $template = $this->cObj->fileResource($this->conf['template.']['latest_rss']); $template = $this->cObj->getSubpart($template, '###LATEST_RSS###'); $templateRow = $this->cObj->getSubpart($template, '###LATEST_POST###'); $limit = $this->latest_limitTopic; $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 't.topic_last_post_id as post_id, t.uid as topic_id, t.*, f.uid as forum_id, f.forum_name as forum_name, c.forum_name as category_name, p.post_time as lastpost_time, l.post_text as lastpost_text, l.cache_text as lastpost_cache, l.post_id, u.username', 'tx_mmforum_posts p, tx_mmforum_forums f, tx_mmforum_forums c, tx_mmforum_topics t, tx_mmforum_posts_text l, fe_users u', 'p.uid = t.topic_last_post_id AND f.uid = p.forum_id AND c.uid = f.parentID AND p.uid = l.post_id AND p.deleted = 0 AND t.deleted = 0 AND f.deleted = 0 AND c.deleted = 0 AND l.deleted = 0 AND u.deleted = 0 AND p.hidden = 0 AND t.hidden = 0 AND f.hidden = 0 AND c.hidden = 0 AND l.hidden = 0'. $this->getMayRead_forum_query('f'). $this->getMayRead_forum_query('c'). $this->getCategoryLimit_query('c'), 'p.topic_id', 't.topic_last_post_id DESC', $limit ); while($arr = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 'action' => 'list_post', 'tid' => $arr['topic_id'] ); if($this->getIsRealURL()) $linkParams[$this->prefixId]['fid'] = $arr['forum_id']; $topiclink = $this->getAbsUrl($this->get_pid_link ($arr['post_id'],'',$conf)); $topictext = $this->cObj->crop($arr['lastpost_text'],'500| ...|1'); $topichtml = $this->cObj->crop($arr['lastpost_cache'],'2000| ...|1'); $catname = $arr['category_name'].' / '.$arr['forum_name']; '###TOPICLINK###' => $topiclink, '###TOPICDATE###' => $posttime, '###TOPICHTML###' => $topichtml, // liegt in CDATA ); $rowContent .= $this->cObj->substituteMarkerArray($templateRow, $rMarker); } $template = $this->cObj->substituteSubpart($template, '###LATEST_POST###', $rowContent); '###FORUMURL###' => $this->getAbsUrl($this->pi_getPageLink($this->conf['pid_forum'])), ); $template = $this->cObj->substituteMarkerArrayCached($template, $marker); return $template; }
Diese Funkion muss natürlich noch ausgeführt werden. Daher die Switch-Konstruktion in Zeile 232 wie folgt erweitern:
case "LATEST_RSS": return $this->list_latest_rss();
Nun noch eine kleine Korrektur an der Funktion evalConfigValues(). Dort die Zeile
if($code == 'LATEST') {
durch
ersetzen.
if($code == 'LATEST' OR 'LATEST_RSS') {
Weiter gehts mit der flexform_ds_pi1.xml. Dort das Feld code um folgende Auswahlmöglichkeit erweitern:
[HTML]<numindex index="8" type="array">
<numindex index="0">RSS</numindex>
<numindex index="1">LATEST_RSS</numindex>
</numindex>
[/HTML]
Desweiteren den Elementen exclCategories_latest und exclCategories eine weitere displayCond hinzufügen:
[HTML]<displaycond>FIELD:code:=:LATEST</displaycond>
<displaycond>FIELD:code:=:LATEST_RSS</displaycond>
[/HTML]
Das war ja auch schon das schlimmste.
Die Templatedatei latest_rss.html mit folgendem Inhalt anlegen:
[HTML]<!-- ###LATEST_RSS### begin --><?xml version="1.0" encoding="ISO-8859-1"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>###FORUMNAME###</title>
<link />###FORUMURL###</link>
<description>Aktuellste Beiträge des ###FORUMNAME###.</description>
<language>de</language>
<lastbuilddate>###LASTBUILT###</lastbuilddate>
<generator>TYPO3 4.1 CMS</generator>
<ttl>60</ttl>
<!-- ###LATEST_POST### -->
<item>
<title>###TOPICNAME###</title>
<link />###TOPICLINK###</link>
<pubdate>###TOPICDATE###</pubdate>
<description>###TOPICTEXT###</description>
<content:encoded><![CDATA[
###TOPICHTML###
]]></content:encoded>
<category>###CATNAME###</category>
<dc:creator>###TOPICAUTHOR###</dc:creator>
</item>
<!-- ###LATEST_POST### -->
</channel>
</rss>
<!-- ###LATEST_RSS### end -->
[/HTML]
Die Templatedatei würde ich gerne per TypoScript konfigurieren. Daher eine neue Zeile TS im Setup:
[HTML]latest_rss = {$plugin.tx_mmforum.style_path}/forum/latest_rss.html[/HTML]
Jetzt einfach eine neue Seite mit dem Seiteninhalt "mm_forum" -> Ansicht "RSS" erstellen und die Kategorien/Anzahl der Beiträge definieren. Damit die Seite richtig als XML ausgegeben wird, empfehle ich ein Ext.-Template mit folgendem Setup:
[TS]page = PAGE
page.10 < styles.content.get
page.config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:application/xml
xhtml_cleaning = 0
admPanel = 0
}
}
#Content Elemente aufräumen und Kommentare entfernen
tt_content.stdWrap.dataWrap >
tt_content.stdWrap.prefixComment >
tt_content.default.prefixComment >
tt_content.list.20.stdWrap.prefixComment >
[/TS]
Ich übernehme natürlich keine Verantwortung und bin mir bestens bewusst, dass das quick & dirty ist.
Beste Grüße!
Philipps