Bug #59533
closedOptionSplit cObjNum inside FILES CO does not work
0%
Description
Please look at the following TS code below.
In my opinion the TS is correct. But this section does not work.
*cObjNum = 1 || 2* 1.current = 1 1.wrap = <h2>|</h2> 2.current = 1 2.wrap = <p>|</p>
It should output <h2>first text</h2> and <p>second text</p>. It does output, <h2>first text</h2> <h2>second text</h2> though. So the option split does not seem to work. I tried this outside the FILES Content Object and it works without problems.
lib.headerSlider = FILES lib.headerSlider { references { table = pages ##fieldName = media data = levelmedia:-1, slide treatIdAsReference = 1 } sorting = sorting_foreign renderObj = COA renderObj { 10 = TEXT 10 { data = file:current:description split { token = - cObjNum = 1 || 2 1.current = 1 1.wrap = <h2>|</h2> 2.current = 1 2.wrap = <p>|</p> } wrap = <div class="text">|</div> } 20 = IMAGE 20 { file { import { data = file:current:publicUrl } width = 950c height = 300c } altText.data = file:current:description } wrap = <div class="slide">|</div> } }
Updated by Christian Tauscher over 10 years ago
I can confirm this Bug.
lib.supersized = TEXT
lib.supersized {
data = levelmedia: -1, slide
split {
token = ,
token.wrap = |
cObjNum = 1 |*| 1 |*| 2
1 {
10 = FILES
10 {
references {
table = pages
uid.data = leveluid: -1, slide
fieldName = media
}
renderObj = TEXT
renderObj {
data = file:current:publicUrl
wrap = { image : '|' },
}
}
}
2 < .1
2.10.renderObj.wrap = { image : '|' }*
}
}
This shoud render as { image : 'fileadmin/background/PSF023.jpg' }, { image : 'fileadmin/background/PSF035.jpg' }*
but is renders as: { image : 'fileadmin/background/PSF023.jpg' }, { image : 'fileadmin/background/PSF035.jpg' }, { image : 'fileadmin/background/PSF023.jpg' }* { image : 'fileadmin/background/PSF035.jpg' }*
The */+ is only to make the bug more visible.
Adding a third image on the media field, extendig the split:
lib.supersized.split.cObjNum = 1 |*| 2 |*| 3
lib.supersized.split.3 < .1
lib.supersized.split.3.10.renderObj.wrap = { image : '|' }+
results in :
{ image : 'fileadmin/background/PSF023.jpg' }, { image : 'fileadmin/background/PSF035.jpg' }, { image : 'fileadmin/background/PSF036.jpg' }, { image : 'fileadmin/background/PSF023.jpg' }+ { image : 'fileadmin/background/PSF035.jpg' }+ { image : 'fileadmin/background/PSF036.jpg' }+ { image : 'fileadmin/background/PSF023.jpg' }, { image : 'fileadmin/background/PSF035.jpg' }, { image : 'fileadmin/background/PSF036.jpg' },
I expect { image : 'fileadmin/background/PSF023.jpg' }, { image : 'fileadmin/background/PSF035.jpg' }* { image : 'fileadmin/background/PSF036.jpg' }+
This problem since V6.0 ad still in V6.2, in V4.7 it worked perfectly (of course without the references, due to lacking FAL)
Updated by Christian Futterlieb almost 10 years ago
Same here. Sadly this bug affects the key feature for responsive image rendering (see example below).
The problem is (obviously) that the optionSplit is made in the FILES cObject and thus cannot be repeated in the renderObj.
lib.test = FILES lib.test { # sys_file uid references.files = 1 renderObj = IMAGE renderObj { file.import.data = file:current:uid file.treatIdAsReference = 1 layoutKey = srcset layout.srcset { element = <img src="###SRC###" sizes="100vw" srcset="###SOURCECOLLECTION###"###PARAMS######ALTPARAMS######SELFCLOSINGTAGSLASH###> # this optionSplit does not work source = |*|###SRC### ###SRCSETCANDIDATE###,|*|###SRC### ###SRCSETCANDIDATE### } sourceCollection { small { width = 200m srcsetCandidate = 200w } mid { width = 400m srcsetCandidate = 400w } } } }
Updated by Jo Hasenau almost 10 years ago
So this is not a bug, but a missing feature. But I guess there are some workarounds, that would give you the desired result with current TypoSript.
Currently it is true, that it is not possible to have kind of "nested option split", so the part for the source won't work in your example.
Should be the same for split or FILES within menu items.
Updated by Stephan Leithold over 9 years ago
The workaround therefore is listnum. It's not so comfortable, but it works.
10 = TEXT 10.data = file:current:description 10.wrap = <h1>|</h1> 10.listNum = 0 10.listNum.splitChar = 10 20 < .10 20.wrap = <h2>|</h2> 20.listNum = 1 30 < .10 30.wrap = <p>|</p> 30.listNum = 2
Updated by Riccardo De Contardi almost 7 years ago
- Status changed from New to Needs Feedback
Correct me if I am wrong, but in version 8, with the FLUIDTEMPLATE dataprocessors (https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Fluidtemplate/Index.html#dataprocessing) and cropvariants (https://docs.typo3.org/typo3cms/extensions/core/8.7/Changelog/8.6/Feature-75880-ImplementMultipleCroppingVariantsInImageManipulationTool.html) everything reported here can be solved even without TypoScript code.
For example (reduced and poorly written example, but just to give the idea):
TS Setup
page.10 = FLUIDTEMPLATE page.10{ // ... // skipping all non-relevant configuration // ... dataProcessing{ 99 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor 99 { references { table = pages fieldName = media } as = headerImage } } }
HTML (template or partial):
<f:for each="{headerImage}" as="image" iteration="iterator"> <f:if condition="{iterator.isFirst}"> <f:then> <h2> {image.description}</h2></f:then> <f:else> <p> {image.description}</p></f:else> </f:if> <p><f:image src="{image.publicUrl}"/></p> </f:for>
Updated by Alexander Opitz over 6 years ago
- Status changed from Needs Feedback to Closed
No feedback within the last 90 days => closing this issue.
If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.