Rss: Unterschied zwischen den Versionen
| Zeile 89: | Zeile 89: | ||
</pre> | </pre> | ||
| + | Oder auch so wie es bei wt_gallery gemacht wird. Interessanterweise zeigt in diesem Fall der Firefox gleich in der Adressleiste an, daß es einen Feed gibt: | ||
| + | |||
| + | <pre> | ||
| + | # add rss feed to header | ||
| + | page.headerData.3135 = COA | ||
| + | page.headerData.3135 { | ||
| + | wrap = <link rel="alternate" type="application/rss+xml" title="RSS-Feed" href="|" /> | ||
| + | |||
| + | 10 = TEXT | ||
| + | 10.data = getIndpEnv:TYPO3_SITE_URL | ||
| + | |||
| + | 20 = TEXT | ||
| + | 20 { | ||
| + | typolink.parameter.data = page : uid | ||
| + | typolink.additionalParams = &type=3135 | ||
| + | typolink.addQueryString = 1 | ||
| + | typolink.returnLast = url | ||
| + | } | ||
| + | } | ||
| + | |||
| + | </pre> | ||
Zum Vergleich das Original statische Template | Zum Vergleich das Original statische Template | ||
Version vom 26. April 2010, 20:27 Uhr
Beispiel für Link im Header der Seite
<link rel="alternate" type="application/rss+xml" title="t3n Magazin RSS Feed" href="http://t3n.de/magazin/feed/" />
RSS für TYPO3
tt_news Beiträge lassen sich sehr einfach als RSS News Feed bereitstellen.
Quick
Statisches Template
Statisches Template von tt_news einbinden. Es heißt: News Feed (RSS,RDF,Atom)
TypoScript anpassen
Nimmt man das statische Template kann man im Constant Editor die wichtigsten Einstellungen machen.
Beispiel Constants
plugin.tt_news.displayXML.rss2_tmplFile = fileadmin/templates/news/rss_2.tmpl plugin.tt_news.displayXML.xmlTitle = HfWU News plugin.tt_news.displayXML.xmlLink = http://www.hfwu.de/ plugin.tt_news.displayXML.xmlDesc = News Feed der Hochschule für Wirtschaft und Umwelt plugin.tt_news.displayXML.xmlLang = de plugin.tt_news.displayXML.xmlLimit = 12
Template anpassen
Link und Anleitung
Erläuterungen
tt_news stellt ein statisches Template bereit, daß die wichtigsten Einstellungen vornimmt. Man kann natürlich auch alles selber machen. Wie unten im Beispiel gezeigt. Aber einfacher ist das statische.
Beispiel für eigenes TypoScript (Setup)
### RSS ###
# Configure tt_news to display the xml template
plugin.tt_news {
displayXML {
# rss091_tmplFile = EXT:tt_news/res/rss_0_91.tmpl
# rdf_tmplFile = EXT:tt_news/res/rdf.tmpl
# atom03_tmplFile = EXT:tt_news/res/atom_0_3.tmpl
# atom1_tmplFile = EXT:tt_news/res/atom_1_0.tmpl
rss2_tmplFile = EXT:tt_news/res/rss_2.tmpl
# possibile values: rss091 / rss2 / rdf / atom03 / atom1
xmlFormat = rss2
xmlTitle = dekra-aviation: News
xmlLink = http://dekra-aviation.com/
xmlDesc = Latest News
xmlLang = de
xmlIcon = fileadmin/tt_news_article.gif
title_stdWrap.htmlSpecialChars = 1
title_stdWrap.htmlSpecialChars.preserveEntities = 1
subheader_stdWrap.stripHtml = 1
subheader_stdWrap.htmlSpecialChars = 1
subheader_stdWrap.htmlSpecialChars.preserveEntities = 1
subheader_stdWrap.crop = 100 | ... | 1
subheader_stdWrap.ifEmpty.field = bodytext
xmlLastBuildDate = 1
}
}
## This enables the xml news feed
xmlnews = PAGE
xmlnews {
typeNum = 100
10 >
10 < plugin.tt_news
10.pid_list >
10.pid_list = 322
10.singlePid = {$plugin.tt_news.singlePid}
10.defaultCode = XML
config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:text/xml
no_cache = 1
xhtml_cleaning = 0
}
}
In diesem Fall muß man auch den Header selbst setzen, damit der Browser / Feed Reader den Feed erkennt:
page.headerData.20 = TEXT page.headerData.20.value = <link rel="alternate" type="application/rss+xml" title="Dekra Aviation RSS-Feed" href="http://dekra-aviation.de/index.php?id=434&type=100">
Oder auch so wie es bei wt_gallery gemacht wird. Interessanterweise zeigt in diesem Fall der Firefox gleich in der Adressleiste an, daß es einen Feed gibt:
# add rss feed to header
page.headerData.3135 = COA
page.headerData.3135 {
wrap = <link rel="alternate" type="application/rss+xml" title="RSS-Feed" href="|" />
10 = TEXT
10.data = getIndpEnv:TYPO3_SITE_URL
20 = TEXT
20 {
typolink.parameter.data = page : uid
typolink.additionalParams = &type=3135
typolink.addQueryString = 1
typolink.returnLast = url
}
}
Zum Vergleich das Original statische Template
Constants:
[GLOBAL]
###
# These are the default TS-constants for RSS feeds from tt_news
##
plugin.tt_news {
displayXML {
# cat=plugin.tt_news/file/80; type=file[html,htm,tmpl,txt]; label= RSS-News rss v2 Template File: XML template for RSS 2.0 feed
rss2_tmplFile = EXT:tt_news/res/rss_2.tmpl
# cat=plugin.tt_news/file/81; type=file[html,htm,tmpl,txt]; label= RSS-News rss v0.91 Template File: XML template for RSS 0.91 feed.
rss091_tmplFile = EXT:tt_news/res/rss_0_91.tmpl
# cat=plugin.tt_news/file/82; type=file[html,htm,tmpl,txt]; label= RDF-News RDF Template File: XML template for RDF feed.
rdf_tmplFile = EXT:tt_news/res/rdf.tmpl
# cat=plugin.tt_news/file/83; type=file[html,htm,tmpl,txt]; label= Atom-News Atom v0.3 Template File: XML template for Atom 0.3 feed.
atom03_tmplFile = EXT:tt_news/res/atom_0_3.tmpl
# cat=plugin.tt_news/file/84; type=file[html,htm,tmpl,txt]; label= Atom-News Atom v1.0 Template File: XML template for Atom 1.0 feed.
atom1_tmplFile = EXT:tt_news/res/atom_1_0.tmpl
# cat=plugin.tt_news//85; type=options[rss091,rss2,rdf,atom1,atom03]; label= News-Feed XML-Format: Defines the format of the news feed. Possible values are: 'rss091', 'rss2' 'rdf', 'atom1' and 'atom03'
xmlFormat = rss2
# cat=plugin.tt_news//86; type=text; label= News-Feed XML-Title: The title of your news feed. (required for rss091, rss2, rdf and atom03)
xmlTitle = example.com: Latest News
# cat=plugin.tt_news//87; type=text; label= News-Feed XML-Link: The link to your hompage. (required for rss091, rss2, rdf and atom03)
xmlLink = http://www.example.com/
# cat=plugin.tt_news//88; type=text; label= News-Feed XML-Description: The description of your news feed. (required for rss091, rss2 and rdf. optional for atom03)
xmlDesc = Latest news from example.com
# cat=plugin.tt_news//89; type=text; label= News-Feed XML-Language: Your site's language. A list of allowable values for <language> in RSS is available at http://backend.userland.com/stories/storyReader$16 (equired for rss091, optional for rss2, not available for rdf, recommended for atom03)
xmlLang = en
# cat=plugin.tt_news//80; type=text; label= News-Feed XML-Icon: Provide an icon for your news feed with preferred size of 16x16 px, can be gif, jpeg or png. (required for rss091, optional for rss2 and rdf, not available for atom03)
xmlIcon = EXT:tt_news/ext_icon.gif
# cat=plugin.tt_news//91; type=int+; label= News-Feed XML-Limit: max news items in RSS feeds.
xmlLimit = 10
# cat=plugin.tt_news//92; type=boolean; label= News-Feed XML-Caching: Allow caching for the RSS feed
xmlCaching = 1
}
}
Setup
###
# This is the default TS-setup RSS feed from tt_news
# this template has to be included after the tt_news main TS-setup because it depends on some settings from there
#
# (see Section Reference in the manual for more options & parameters)
#
# tt_news v 2.x
###
# - - - - - - - - - - - - - - render XML news - - - - - - - - - - - - - #
# point your RSS reader to: http://your-server.org/index.php?type=100
plugin.tt_news {
displayXML {
rss091_tmplFile = {$plugin.tt_news.displayXML.rss091_tmplFile}
rss2_tmplFile = {$plugin.tt_news.displayXML.rss2_tmplFile}
rdf_tmplFile = {$plugin.tt_news.displayXML.rdf_tmplFile}
atom03_tmplFile = {$plugin.tt_news.displayXML.atom03_tmplFile}
atom1_tmplFile = {$plugin.tt_news.displayXML.atom1_tmplFile}
# possibile values: rss091 / rss2 / rdf / atom03
xmlFormat = {$plugin.tt_news.displayXML.xmlFormat}
xmlTitle = {$plugin.tt_news.displayXML.xmlTitle}
xmlLink = {$plugin.tt_news.displayXML.xmlLink}
xmlDesc = {$plugin.tt_news.displayXML.xmlDesc}
xmlLang = {$plugin.tt_news.displayXML.xmlLang}
xmlIcon = {$plugin.tt_news.displayXML.xmlIcon}
xmlLimit = {$plugin.tt_news.displayXML.xmlLimit}
xmlCaching = {$plugin.tt_news.displayXML.xmlCaching}
title_stdWrap.htmlSpecialChars = 1
title_stdWrap.htmlSpecialChars.preserveEntities = 1
subheader_stdWrap.stripHtml = 1
subheader_stdWrap.htmlSpecialChars = 1
subheader_stdWrap.htmlSpecialChars.preserveEntities = 1
subheader_stdWrap.crop = 100 | ... | 1
subheader_stdWrap.ifEmpty.field = bodytext
xmlLastBuildDate = 1
}
}
## This enables the xml news feed
xmlnews = PAGE
xmlnews {
typeNum = 100
10 < plugin.tt_news
10.pid_list >
10.pid_list = {$plugin.tt_news.pid_list}
10.singlePid = {$plugin.tt_news.singlePid}
10.defaultCode = XML
10.catTextMode = 1
10.catImageMode = 0
config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:application/xml
xhtml_cleaning = 0
admPanel = 0
}
}
### CVS id ###
# $Id: setup.txt 3031 2006-05-19 13:58:06Z rupertgermann $