[TYPO3-core] RFC: Use split to fetch a value

Michael Stucki michael at typo3.org
Thu Dec 1 20:11:37 CET 2005


Another CVS patch request:

Problem:
The "split" function works fine split a string and return something based on
the splitted value. However it is not possible to simply return this value!

Solution:
Introduce a new property for the split function that returns the splitted
value and returns it immediately.


TSref changes:

In section "split":

=Property:
returnKey

Data type:
int / stdWrap

Description: 
Instead of parsing the split result, just return this element of the index
immediately.
=

Example:

Parse a custom tt_content field, split it line by line, and assign the
current image element.

tt_content.textpic.20.longdescURL.typolink {
        # Only return the URL, not the full <a href="..."> link
        returnLast 
        parameter {
                # This is a new db field where users can enter a longdescURL
                # one line per image
                field 
                split {
                        # Split at newline
                        token.char 
                        # This is the new property: Return the x-th element
                        returnKey.data                 }
        }
}


If there is an existing way to get this value (I don't think so) please let
me know...

Michael
-- 
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: split.diff
Type: text/x-diff
Size: 914 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20051201/ca348850/attachment.bin 


More information about the TYPO3-team-core mailing list