Project

General

Profile

Actions

Feature #52495

closed

Allow to implode the output of COA/COA_INT with some glue

Added by Rémy DANIEL about 11 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Content Rendering
Target version:
-
Start date:
2013-10-03
Due date:
% Done:

0%

Estimated time:
1.00 h
PHP Version:
5.4
Tags:
Complexity:
easy
Sprint Focus:

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

patch_proposal.diff (1.17 KB) patch_proposal.diff Initial patch Rémy DANIEL, 2013-10-03 11:09
Actions #1

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

Actions #2

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.

Actions #3

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.

Actions #4

Updated by Ernesto Baschny about 11 years ago

  • Target version deleted (6.2.0)
Actions #5

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?

Actions #6

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.

Actions

Also available in: Atom PDF