Feature #52495
closedAllow to implode the output of COA/COA_INT with some glue
0%
Description
Many times I need to implode some pieces of content in my output.
In PHP, it is easy : I use implode() function on a array of arbitrary elements.
But in TypoScript, it is such a pain. I need to do multiple .noTrimWrap on all COA elements, and because I don't know in advance the real number of outputed elements, the final output contains sometimes an unwanted additional glue.
Before :
lib.title.meta = COA lib.title.meta { wrap = <p class="meta">|</p> 10 = TEXT 10.data = firstname 10.noTrimWrap = | - | | 10.if.isTrue.data = firstname 20 = TEXT 20.data = city 20.noTrimWrap = | - | | 20.if.isTrue.data = city 30 = TEXT 30.data = country 30.noTrimWrap = | - | | 30.if.isTrue.data = country }
After :
lib.title.meta = COA lib.title.meta { wrap = <p class="meta">|</p> glue.noTrimWrap = | - || 10 = TEXT 10.data = firstname 10.if.isTrue.data = firstname 20 = TEXT 20.data = city 20.if.isTrue.data = city 30 = TEXT 30.data = country 30.if.isTrue.data = country }
Please review the attached patch, and tell me what you think.
I already use this in all of my projects.
Files
Updated by Martin Holtz about 11 years ago
IMHO this is would be a very special function.
You can just adjust your TypoScript to have few lines:
lib.title.meta = COA lib.title.meta { wrap = <p class="meta">|</p> 10 = TEXT 10.data = firstname 10.required = 1 10.noTrimWrap = | - | | 20 < .10 20.data = city 30 < .10 30.data = country }
greetings,
martin
Updated by Rémy DANIEL about 11 years ago
Hi Martin
I know I can reduce my Typoscript, but I still can't manage the case when one of the element is absent.
In this case, there is still a remaining glue at the begining of the output.
Updated by Mathias Brodala about 11 years ago
DANIEL Rémy wrote:
I know I can reduce my Typoscript, but I still can't manage the case when one of the element is absent.
In this case, there is still a remaining glue at the begining of the output.
Only a workaround but in this case you can use stdWrap.substring
to get rid of that additional glue. For this you have to know the length of the glue, of course.
Updated by Mathias Schreiber almost 10 years ago
- Status changed from New to Needs Feedback
- Assignee set to Mathias Schreiber
Hi Daniel,
doesn't the required = 1 do just that?
Updated by Alexander Opitz over 9 years ago
- Status changed from Needs Feedback to Closed
- Assignee deleted (
Mathias Schreiber)
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.