[TYPO3-english] TS Code Reuse

Scotty C superscotty19 at yahoo.com
Thu Mar 26 04:34:07 CET 2015


Hi again,
In my ongoing pursuit of defeating the TS monster, I have (hopefully) one more question and then I'll be good for a while ;-)
I want to cleanup/minimize/optimize my code
I have created a large chunk of TS, let's say:
Constants:title1 = <h1>Title1</h1>title2 = <h1>Title2</h1>
Setup:temp.myFunc1 = TEXTtemp.myFunc1 {   ...    .... {$title1}}
temp.myFunc2 = TEXTtemp.myFunc2 {   ...    .... {$title2}}
myFunc1 and myFunc2 are exactly the same, except that myFunc1 references title1 and myFunc2 references title2. Is there any way to reuse/merge the code and then just pass the constant, kind of like a function in a programming language? I know TS is not a programming language, but I'm hoping this can be done - something like
temp.myFunc($title) = TEXTtemp.myFunc {   ...   $theTitle = $title}
marks.TEST1 < temp.myFunc({$title1})marks.TEST2 < temp.myFunc({$title2})

Thanks as always!-Scott.



More information about the TYPO3-english mailing list