[TYPO3-dev] Extensions with more TS support

Franz Koch typo.removeformessage at fx-graefix.de
Thu Nov 5 10:40:46 CET 2009


Hi,

> I know a bit offtopic but it would be cool to find one way which is as 
> often used as possible in every extension.
> 
> I am using a function like this http://pastebin.com/f677b473e to prefill 
> markers in a view. There are 2 options
> 
> 1.) Language Markers. From a list of keys (given by TS) language Markers 
> are rendered. Just add another key in the TS (e.g. 
> plugin.tx_fo_pi1.listView.ll = key1,key2,key3) and you will get a marker 
>  like ###LL_KEY1###, ###LL_KEY2###, ...
> 
> 2.) Possibility to generate generic keys by just using TS.
> TS could be like
> plugin.tx_fo_pi1.listView.generic.abc = TEXT
> plugin.tx_fo_pi1.listView.generic.abc.value = def
> 
> and there will be a marker ###ABC###
> 
> A call to this function would be in the listview and would look like
> $markerArray = $this->prefillMarker($markerArray, 
> $this->conf['list.']['ll'], $this->conf['list.']['generic.']);
> 
> What you think?

+1, but I'd go a bit further and implement it the way cal is doing it 
right now. Cal is only rendering/processing markers and language labels 
that actually are in your templates and doesn't process every possible 
marker from your TS-setup or php-code (yes, even markers filled from 
within php are only processed on demand). So adding a new marker is 
simply adding it to the template and provide the TS-rendering definition 
for it - like in your example. But as only those markers get processed 
that are used in your templates you have no overhead.

Cal is going even a bit further with language markers. You can add 
language markers anywhere you want, even somewhere in your TS (so no 
need for complex TS constructs only to localize a small part of the TS 
output). Right before returning the content, cal is parsing the output 
for language markers and replacing them in one go. So if you have a list 
with repeated language markers, those do only get processed once and not 
in every loop of your code. And here too, only those markers get 
processed that are actually in your code and you don't have to manage a 
list where you say which language markers you like to have.

Language markers in cal look like %%%ll-key-name%%% - so they use % 
instead of # and are thus easy to identify within your code.

-- 
kind regards,
Franz Koch

---------------------------------------------------
PayPal-Account: 'paypal _at_ elements-net _dot_ de'
---------------------------------------------------




More information about the TYPO3-dev mailing list