Skip to content

Instantly share code, notes, and snippets.

@alienlebarge
Created April 5, 2012 08:44
Show Gist options
  • Save alienlebarge/2309253 to your computer and use it in GitHub Desktop.
Save alienlebarge/2309253 to your computer and use it in GitHub Desktop.
Generat a RSS 2.0 version of Typo3 page content
xmlpage = PAGE
xmlpage {
typeNum = 100
# Disable all standard header generation by TYPO3
config.disableAllHeaderCode = 1
# Setup correct content type header for XML
config.additionalHeaders = Content-Type: application/xml
# Output XML header
10 = TEXT
10 {
value = <?xml version="1.0"?>
postCObject = TEXT
postCObject.char = 10
} # /10
20 = TEXT
20 {
value = <rss version="2.0"><channel>
postCObject = TEXT
postCObject.char = 10
} # /20
# Title
30 = TEXT
30 {
insertData = 1
value = {page:title // page:subtitle}
wrap = <title>|</title>
} # /30
# Link
40 = COA
40 {
wrap = <link>|</link>
# Base URL
10 = TEXT
10 {
typolink {
parameter.data=TSFE:baseUrl
returnLast=url
} #/typolink
} # /10
# Page URL
20 = TEXT
20 {
typolink {
parameter.data=TSFE:id
returnLast=url
} #/typolink
} # /20
} # /40
# Description
50 = TEXT
50 {
wrap = <description>|</description>
insertData = 1
value = {page:description // page:abstract}
} # /40
# lastBuildDate
60 = TEXT
60 {
#insertData = 1
data = page:SYS_LASTCHANGED
strftime = %a, %d %b %Y %H:%M:%S %Z
wrap = <lastBuildDate>|</lastBuildDate>
} # /50
# Content
70 = CONTENT
70 {
table = tt_content
select {
selectFields = uid, header, bodytext
pidInList = this
orderBy = sorting
} # /select
renderObj = COA
renderObj {
wrap = <item>|</item>
# Title
10 = TEXT
10 {
field = header
stdWrap.dataWrap = <title>|</title>
} # /10
# Link
20 = COA
20 {
wrap = <link>|</link>
10 = TEXT
10 {
typolink {
parameter.data=TSFE:baseUrl
returnLast=url
} #/typolink
} # /10
20 = TEXT
20 {
typolink {
parameter.field = pid
parameter.dataWrap=|#{field:uid}
returnLast=url
} #/typolink
} # /20
} # /20
# Description
30 = TEXT
30 {
field = bodytext
stdWrap.crop = 150 | ... | 1
stdWrap.dataWrap = <description>|</description>
} # /30
# Content
40 = TEXT
40 {
field = bodytext
#stdWrap.dataWrap = <content:encoded><![CDATA[|]]></content:encoded>
wrap = <content:encoded><![CDATA[|]]></content:encoded>
} # /40
} # /renderObj
} # /70
200 = TEXT
200.value = </channel></rss>
} # /xmlpage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment