[TYPO3-ect] Improvement of the template engine

Jan-Hendrik Heuing [DD] jh at digitaldistrict.de
Wed Mar 15 18:57:05 CET 2006


It seems interesting to also implement simple logic as well.

It's like having odd and even rows, which have another wrap around, which 
should only be displayed if there is content at all... You can all do that 
in the typo3-way, but it's not as comfortable as it could be.

the typo3-way:
<!-- ###somewrapperifthereiscontentinthetable### -->
  <table>
    <!-- ###oddrow### -->
        <tr><td>oddrow</td></tr>
    <!-- ###oddrow### -->
    <!-- ###evenrow### -->
        <tr><td>evenrow</td></tr>
    <!-- ###evenrow### -->
  </table>
<!-- ###somewrapperifthereiscontentinthetable### -->


This is rather complicate to use in your php. Not in terms of complexity, 
more in terms of annoyance ;) It might be worth looking at other template 
engines to find some useful ways of doing those things in less time. Though 
I am not speaking of templating like smarty, while it might be worth looking 
at it...

Any ideas about that?

JH

"Franz Koch" <typo3 at fx-graefix.de> schrieb im Newsbeitrag 
news:mailman.1.1141919617.24611.typo3-team-extension-coordination at lists.netfielders.de...
> 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