[TYPO3] Splitting for a filename extenision
Peter Meijer
peter.meijer at tros.nl
Tue Apr 4 13:35:07 CEST 2006
Thnx very much!
You only forgot one } ;)
It now works :)
Cheers
Peter Meijer
JoH wrote:
>> Currently I'm working on a project where I must display a filename
>> with a specific icon (pdf, word, jpg, etc).
>>
>> Now I must extract the extension from the filename.
>> For example:
>>
>> Filename: filename.pdf
>>
>> Typoscript:
>> subimage = TEXT
>> subimage.field = media
>> subimage.split {
>> token.char = 46
>> cObjNum = 1
>> 1.current = 1
>> 1.wrap = |
>> }
>> subimage.wrap = |
>>
>> return: filename and pdf
>>
>> Now I get the first part of the split back, and I must get the last
>> part.
>>
>> How can I get the last part?
>>
>> That was part 1 of the problem.
>>
>> Now it's also possible to add files with multiple dots, like:
>> filename.new.pdf
>>
>> In this case the above typoscript won't work.
>> I know that there is a session variable called: SPLIT_COUNT and with
>> that variable I can make a loop and then find the last part of the
>> split.
>>
>> But how can I get the session variable into typoscript?
>
> It's a Register and you can access it by using the stdWrap function data,
> which is of type getText.
>
> 10 = TEXT
> 10.data = register:SPLIT_COUNT
>
> But you don't need it here, since split offers you optionSplit properties.
>
> subimage = TEXT
> subimage {
> field = media
> split {
> token.char = 46
> cObjNum = |*| 1 |*| 2
> 1 = TEXT
> 2.current = 1
> }
>
> Will produce empty TEXT for every part except the last one which will be
> "current" instead.
>
> Not tested.
>
> Joey
>
More information about the TYPO3-english
mailing list