[TYPO3-ect] Improvement of the template engine

Franz Koch typo3 at fx-graefix.de
Thu Mar 9 16:53:50 CET 2006


Hi,

maybe this might be interesting for this topic. On my extensions I use a 
parser that extracts all markers from a template. Afterwards the markers 
get parsed through a rendering function that fills the markers depending 
on their markup.

e.g.:
- Marker ###LABEL::FIELDNAME### gets filled with a LLL-label
- Marker ###FIELD::FIELDNAME### gets filled with a form-field
   depending on TCA with evaluation over TS-definitions
- Marker ###LABEL::FIELD_FIELDNAME### returns the LLL-label for the
   formfield (if differs from the non-form value) and e.g. get's wrapped
   with <label for="tx_myext[FIELDNAME]">|</label>.
   If the label is not found in e.g. myext\pi1\lllfile.xml it's filled
   with TCA-labels
- Marker ###GROUP::BOTTOM### returns all fields for the field-group
   'bottom' which can be defined in the flexform of the extension
- Marker ###VALUE::FIELDNAME### returns the parsed database value
- Marker ###DESC::FORMUSE### filled with some description

Markers with no value are simply set empty - as well es field-labels 
where the field is f.e. not visible for a FE-user (I use some kind of 
rights-management for visible fields for FE-groups). Could be extended 
with much more, f.e. ###EXT::TTNEWS:LISTVIEW###, ###TS::lib.myObject###.

Advantage would be, that the template is completely multilingual as 
everything is fetched from locallang.php/xml which keeps the used 
html-templates heavily reduced on multilingual pages. And additional 
language-markers can easily be added through TS 
(tx_myext_pi1._LOCAL_LANG.default.newMarker = Hi there).

On my latest extension I also use this for generating approval-mails ouf 
of pure LLL-values.

All in all it is an API, but I haven't extracted it yet.

-- 
Kind regards,
Franz Koch



More information about the TYPO3-team-extension-coordination mailing list