[TYPO3-dev] Extensions with more TS support

JoH asenau info at cybercraft.de
Thu Nov 5 11:58:45 CET 2009


> +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.

Well - this is not going "further" but would be the default behaviour if
people would start using TypoScript the way it was meant to be. Which is not
the case for cal as well as for so many other extensions.

plugin.blah = USER
plugin.blah {
    userFunc = className->mainFunctionName
    renderObj = TEMPLATE
    renderObj {
        template = FILE
        template.file = blah
        subparts {
            SUBPARTNAME = COA
            SUBPARTNAME {
                10 = USER
                10.userFunc = className->functionName
            }
        }
        marks {
            MARKNAME = COA
            MARKNAME {
                10 = USER
                10.userFunc = className->functionName
            }
        }
    }
}

This will use the subpart SUBPARTNAME and the mark MARKNAME only.
If you need more, simply put them into your TS template, add the necessary
functions to your class  - done!
If you need wraps, stdWrap functions or other stuff to be applied to your
marks and subparts, simply add them to the corresponding COA.
If you want to enable or disable caching, make it a COA_INT or a USER_INT
instead.
If you need language support, just do something like the following and to
make these values editable for admins, fill in some constants and make them
available with the constant editor.

Setup:
marks.MARKNAME = TEXT
marks.MARKNAME {
    value = Default value
    lang {
        de = {$markname.german}
        en = {$markname.english}
    }
}

Constants:
#cat = plugin/marks/1; type=text; label=Mark name english
markname.english = an english text
#cat = plugin/marks/2; type=text; label=Marker Name deutsch
markname.german = Ein Deutscher Text

This works even for FORM values and labels.

Life could be so easy for extension developers if they just tried to
understand TypoScript first.
Even from an MVC point of view, the database would be the model, the PHP
plugin the controller and TypoScript would create the view.

Just my 22 TS cents

HTH

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
Xing: http://contact.cybercraft.de
Twitter: http://twitter.com/bunnyfield
TYPO3 cookbook (2nd edition): http://www.typo3experts.com






More information about the TYPO3-dev mailing list