Today I had to create an easy maintainable link-list inside an FCE. As TYPO3 does not offer any native link-lists, you have to make it yourself. Well after some time and try-out I got something working, and a beer from Steffen (thank you very much). It works similar to the tt_content.bullets, just that in this case each line contains a text and where it links, like this:
Title | http://google.com - - Google
Title | http://wikipedia.org - - Wikipedia
You may recognize it’s just a text and a complete typolink-parameter. Easy enough - you think. Well take a look and decide if you’ve made the same.
Here is the code (public domain):
10 = TEXT
10.field = field_links
10.wrap =
|
10 {
trim = 1
split {
token.char = 10
cObjNum = 1
1.parseFunc >
# the negative match has to be done first, because the
# following split actually changes the current-value
1.1 = TEXT
1.1.current = 1
1.1.wrap =
|
1.1.if.value.current = 1
1.1.if.matches = /\|/
1.1.if.negate = 1
# continue with destructive splitting
1.2 = TEXT
1.2.current = 1
1.2.wrap =
|
1.2.if.value.current = 1
1.2.if.matches = /\|/
1.2.trim = 1
1.2.split {
token = |
cObjNum = |*|1||2|*|
# we don’t put the string into value, so we would not need to delete it
# if we would delete it with ‘>’, the LOAD_REGISTER will not work
1.parseFunc >
1.1 = LOAD_REGISTER
1.1.title.current = 1
# we don’t put the string into value, so we don’t overwrite 2.1
# if we would overwrite 2.1, the RESTORE_REGISTER will kill all data
2.parseFunc >
2.2 = RESTORE_REGISTER
2.trim = 1
# so this is it, first fragment into value, second directly into typolink
# the order of execution is sorted, so don’t worry about the strange order here
2.1 = TEXT
2.1.data = register:title
2.typolink {
parameter.current = 1
ATagParams = rel=”shadowbox”
target =
extTarget =
}
}
}
}