[TYPO3-english] Show usergroup and fe_user info

bernd wilke t3ng at bernd-wilke.net
Thu Nov 14 08:45:17 CET 2013


Am 14.11.13 03:36, schrieb Miguel:
> Great news, you've done it once again ! An ".stdWrap.if" worked as a
> charmed !
>
> Dear god, i can't thank you enough for what you have done with me, your
> patience, your work, and all the time you wasted with me... Thank you so
> much Bernd.
>
> Now i have another big mountain to climb: in some cases, the user can
> belong to more than just 1 expiring group, so i need to show both
> usergroups in the frontend.
>
> This would be easy if the extension applied to the fields always the
> same token, but unfortunelly it doesnt... When a user has 2 timed
> usergroups, the extension separates them with an asterisk, like this "
> 3|1384385040|1384385160*5|1384389960|1385772360* " (the 5 after the
> first asterisk is the beginning of the second timed usergroup). If the
> extension developer had made the separation with another "|" it would be
> much easier.

that is a very unusual splitchar (I would have expected a LF), but 
should not be a problem. (the same splitchar would be more difficult to 
handle!)
except that you may have an empty entry as there is a '*' after the last 
filled entry ?
keep this in mind as it may need an additional stdWrap.if.isTrue

> But well, once it isn't made like this, my thoughts are that the best
> way to do this is by making two new splits: the first one that splits
> the field by the asterisk, and the second one to split the part after
> the asterisk by the token " | ".
>
> However i don't know if this is possible, but i'm half a way there, so
> here is my code:
>
> 20 = TEXT
> 20.data = TSFE:fe_user|user|tx_itypoexpiringfegroups_groups
> 20.split {
>
> token.char = 42
> returnKey = 1
>
> }
> This code shows me this in the frontend: "5|1384389960|1385772360", so i
> think i'm half a way there, as now i only need to split once again the
> given result, but i don't know to do it...
>
> Any suggestions or what i'm asking is impossible?

that is what I mentioned earlier: each of these fields could be a list 
of entries and must therefore be split into single entries before being 
rendered. So you are on the right way. just apply the next split to the 
result from the first split.

20.split {
     token = *
     cObjNum = 1
     1 {
	10 = TEXT
	10.current = 1
	10.split {
	    token = |
	    cObjNum = 1 |*| 2 |*| 2
	    1 {
		10 = CONTENT
		10.table = fe_groups
		:

don't forget: nowadays everything in Typoscript can be stdWrapped and so 
you can do anything to anything

bernd
-- 
http://www.pi-phi.de/cheatsheet.html


More information about the TYPO3-english mailing list