Hallo Leute,
ich schreibe gerade an einer Extension für XML Frontend Rendering. Folgenden Setup Code verwende ich:
# ***************************************************************************
# Notice: "styles." (and "temp.") objects are UNSET after template parsing!
# Use "lib." for persisting storage of objects.
# ***************************************************************************
styles.xmlcontent.get >
styles.xmlcontent.get = CONTENT
styles.xmlcontent.get {
table = tt_content
select.orderBy = sorting
select.languageField = sys_language_uid
renderObj = < xmlcontent
}
#******************************************************
# Including library for processing of some elements:
#******************************************************
includeLibs.xml_contentrendering = EXT:xmlrendering/pi1/class.tx_xmlrendering_pi1.php
#******************************************************
# xmlcontent.tt_content is started.
#******************************************************
xmlcontent >
xmlcontent = CASE
xmlcontent.key.field = CType
temp.wraps{
pageWrap.wrap(
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<!DOCTYPE page [
<!ENTITY lt "&#60;">
<!ENTITY gt ">">
<!ENTITY amp "&#38;">
<!ENTITY apos "'">
<!ENTITY quot """>
<!ENTITY nbsp " ">
]>
<tt:page uid="{page:uid}" xmlns:tt="http://notyetpublished">|</tt:page>
)
contentWrap.dataWrap = <tt:content xmlns:tt="http://notyetpublished" uid="{field:uid}" ctype="{field:CType}" spacebefore="{field:spaceBefore}" spaceafter="{field:spaceAfter}" sorting="{fields:sorting}">|</tt:content>
imageWrap.wrap = <tt:image href="|"></tt:image>
imageListWrap.dataWrap (
<tt:imagelist alt="{field:altText}"
title="{field:titleText}"
orientation="{field:imageorient}"
width="{field:imagewidth}"
height="{field:imageheight}"
longdescriptionurl="{field:longdescURL}"
columns="{field:imagecols}"
border="{field:imageborder}">|</tt:imagelist>
)
imageListWrap.dataWrap.parseFunc = < lib.parseFunc
headerWrap.dataWrap = <tt:headertext align="{field:header_position}">|</tt:headertext>
headerlinkWrap.wrap = <tt:headerlink>|</tt:headerlink>
bodyWrap.dataWrap = <tt:bodytext rte="{field:rte_enable}" layout="{field:layout}" align="{field:text_align}">|</tt:bodytext>
#text_properties
boldWrap.wrap = <tt:bold>|</tt:bold>
italicWrap.wrap = <tt:italic>|</tt:italic>
underlineWrap.wrap = <tt:underlined>|</tt:underlined>
#in the innerpart of the bodytext we use html
#tables
tableWrap.dataWrap = <table border="{field:table_border}">|</table>
tablelineWrap.wrap = <tr>|</tr>
tabledataWrap.wrap = <td>|</td>
#lists
orderedListWrap.wrap = <ol>|</ol>
unorderedListWrap.wrap = <ul>|</ul>
listItemWrap.wrap = <li>|</li>
}
temp.cobj = COA
temp.cobj{
20 = USER
20.wraps < temp.wraps
20.stdWrap < temp.wraps.contentWrap
}
xmlcontent.default = COA
xmlcontent.default.stdWrap < temp.wraps.contentWrap
xmlcontent.default {
10 = TEXT
10.field = header
10.wrap < temp.wraps.headerWrap.wrap
20 = TEXT
20.field = bodytext
20.wrap < temp.wraps.bodyWrap.wrap
30 = TEXT
30.field = header_link
30.wrap < temp.wraps.headerlinkWrap.wrap
}
# CType: image
xmlcontent.image < temp.cobj
xmlcontent.image.20.userFunc = tx_xmlrendering_pi1->image
# CType: text
xmlcontent.text < temp.cobj
xmlcontent.text.20.userFunc = tx_xmlrendering_pi1->text
# CType: textpic
xmlcontent.textpic < temp.cobj
xmlcontent.textpic.20.userFunc = tx_xmlrendering_pi1->textpic
# CType: textpic
#xmlcontent.textpic = COA
#xmlcontent.textpic{
# 10 = COA
# 10{
# 10 = TEXT
# 10.field = altText
# 10.wrap= alt="|"
# 10.stdWrap.parseFunc = < lib.parseFunc
# }
# 10.wrap = <image |/>
#}
# CType: html
xmlcontent.html < temp.cobj
xmlcontent.html.20.userFunc = tx_xmlrendering_pi1->html
# CType: table
xmlcontent.table < temp.cobj
xmlcontent.table.20.userFunc = tx_xmlrendering_pi1->table
# CType: list (also known as "Plugins")
xmlcontent.list = CASE
xmlcontent.list.key.field = list_type
xmlcontent.list.tt_news = ...
// here could go code that implements the XML output of tt_news
// example PAGE object using styles.xmlcontent.get
xml_contentrendering >
xml_contentrendering = PAGE
xml_contentrendering {
typeNum=555
config.disableAllHeaderCode = 1
config.additionalHeaders = Content-type:text/xml
config.admPanel = 0
config.xhtml_cleaning = 0
10 = COA
10 {
wrap < temp.wraps.pageWrap.wrap
20 < styles.xmlcontent.get
}
}
Ich habe nur nun das Problem wenn in einem Field wie {field:altText} ein Text drinne steht mit Anführungszeichen, kein gültiges XML generiert wird. Soweit ich im Sourcecode von Typo3 gesehen habe kann man keinen Einfluss drauf nehmen was mit den Werten gemacht wird, die in einem DataWrap ersetzt werden. Sieht hier jemand eine andere Möglichkeit?