[TYPO3-dev] parsing TSconfig in BE-module?
bernd wilke
t3ng at bernd-wilke.net
Mon Mar 17 09:43:05 CET 2014
Am 14.03.14 19:13, schrieb Torsten Schrade:
> Hi Bernd,
>
>> I don't want hardcoded variations for these 4 pages but a
>> configuration which can handle all kind of stuff.
>>
>
> Just found this thread. Some years ago I had the task to write a BE
> module that was able to import lots XML files with irregularly diverging
> node structures to different pages in the pagetree. I came up with the
> idea of using TypoScript for the import configuration in the TSConfig
> field to parse the stuff because then the configuration could be
> inherited to subpages but also changed very easily to adapt to the
> current XML file's structure. In a way a similar use case to yours only
> in the other direction. The code is quite oldish but maybe it can be a
> source of inspiration, so I've just pushed it to Github for your
> convenience.
>
> https://github.com/digicademy/xmlimport
>
> The points that might be interesting for you are the backend TSFE:
>
> https://github.com/digicademy/xmlimport/blob/master/mod1/class.tx_xmlimport_backendtsfe.php
that might be the solution I expected, I hope the new core structure
would enable this solution without much rewriting.
but meanwhile I realised it with this line (the same way I extract the
data to export):
$exportCmds = file_get_contents('http://'.$_SERVER['SERVER_NAME'] .
'/index.php?id=' . $id . '&L=' . $lang . '&type=30');
I do a further pagetype which is configured in pure typoscript.
basic: just export the current page:
// page30 = list of urls for export (one per line)
page30 = PAGE
page30 {
typeNum = 30
disableBodyTag = 1
config.disableAllHeaderCode = 1
10 = TEXT
10.typolink.parameter.field = uid
10.typolink.returnLast = url
10.noTrimWrap (
|export=|
|
)
}
which can be enhanced on the page with the news overview:
page30 {
// no export of page as it will be overwritten. see 110
10 >
20 = CONTENT
20 {
select {
selectFields = year(from_unixtime(datetime)) as year
languageField = sys_language_uid
orderBy = datetime
groupBy = year
pidInList = 781
where = deleted=0 AND hidden=0
markers {
}
}
table = tx_news_domain_model_news
renderObj = TEXT
renderObj {
typolink {
parameter = 776
additionalParams.cObject = TEXT
additionalParams.cObject {
field = year
wrap = &tx_news_pi1[overwriteDemand][year]=|
}
returnLast = url
}
noTrimWrap (
|export=|
|
)
}
}
// some afterworks: start with current year 'selected'
110 = TEXT
110 {
value = cp de/.../dateFilter/2014.html de/.../pressemitteilungen.html
noTrimWrap (
|exec=|
|
)
}
or on the detailpage with the news:
page30 {
// no default page
// it would be just the error message 'no news id givven'
10 >
// remove definitions from page above (news list)
20 >
// define anew
20 = CONTENT
20 {
select {
selectFields = uid,title,tstamp
languageField = sys_language_uid
orderBy = uid
pidInList = 781
where = deleted=0 AND hidden=0
markers {
}
}
table = tx_news_domain_model_news
renderObj = TEXT
renderObj {
typolink {
parameter = 783
additionalParams.cObject = TEXT
additionalParams.cObject {
field = uid
wrap = &tx_news_pi1[news]=|
}
returnLast = url
}
noTrimWrap (
|export=|
|
)
}
}
// remove definitions from page above (news list)
110 >
}
bernd
--
http://www.pi-phi.de/cheatsheet.html
More information about the TYPO3-dev
mailing list