Project

General

Profile

Actions

Task #51008

closed

Additional Register values in FilesContentObject

Added by Lars Malach over 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Could have
Assignee:
-
Category:
-
Target version:
-
Start date:
2013-08-11
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

FILE_NUM_CURRENT starts with 0. A TypoScript snippet like this would be required to render the last file special:

30 = TEXT
30.value = Yay, last file!
30.if.equals.data = register:FILE_NUM_CURRENT
30.if.value.data = register:FILES_COUNT
30.if.value.stdWrap.wrap = |-1
30.if.value.prioriCalc = 1

In this case it would be wonderful to have an additional register value "FILE_IS_LAST":

30 = TEXT
30.value = Yay, last file!
30.if.isTrue.data = register:FILE_IS_LAST

And there are 4 additional useful register values:
  • FILE_IS_FIRST: Solves the question if number "1" or "0" is the first one
  • FILE_IS_ODD
  • FILE_IS_EVEN
  • FILE_CYCLE: Current number starting with 1

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #49480: Register values in FilesContentObjectClosed2013-06-27

Actions
Actions #1

Updated by Gerrit Code Review over 10 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23027

Actions #3

Updated by Stefan Reichelt over 10 years ago

Thanks for continuing this, Lars!

A few questions:
1. Isn't there any other way to store the variables other than the register?
I think two variables should be fine, but more feels like overusing the registers purpose.
Something like 'file:current:isFirst' would be neat if possible, but from the little I know that might be too much hassle for such a feature...

2. If the register is best (or only) way, could you unset the variables in it again once all files were rendered? Imho, this would be more in line with the idea of leaving it behind how you've found it. Like RESTORE_REGISTER I guess.

3. Out of curiousity: Do you plan to do more with IterationStateUtility? I could imagine a few more usecases for it. It looks quite neat but seems a little overkill if meant only for this feature.

Cheers!

Actions #4

Updated by Wouter Wolters over 9 years ago

  • Status changed from Under Review to Closed

Lars Malach Oct 8, 2013

Abandoned

IterationStateUtility Class is to much for this purpose. All of it is already possible with the optionSplit.

Actions

Also available in: Atom PDF