[Typo3-dev] TypoScript Unleashed

Dennis Petersen fessor at software.dk
Sun Jul 20 16:37:21 CEST 2003


Hi Kasper.
Thank you very much!
This is a great document - but if you like constructive critisism I would
like to give my review here (and some recommendations for improvements - NO
PUN INTENDED!).

Section 1.1.2 TypoScript syntax, object paths, objects and properties

You start by giving 2 examples:
asdf = qwerty

asdf.zxcvbnm = uiop
asdf.backgroundColor = blue

Great! And then you give an example of the latter only:
asdf {
    zxzcvbnm = uiop
    backgroundColor = blue
}

Then you continue to append transperency = 95% to backgroundColor which
contains a nice description of properties also being similar to objects.

Then the note on the internal structure could be better as it only contains
parts from the first example. But what if one wants to combine the first and
second example (which is very often the case as also given as an example in
section 1.3.3), then the internal structure should be explained:
asdf = qwerty
asdf {
    zxcvbnm = uiop
    backgroundColor = blue
    backgroundColor.transperency = 95%
}

This is then where I get confused as I am unsure how the internal structure
is created. But I believe that after reading this section that I have an
idea (Mind you that I have been playing around with it for quite some time
so this is to help newcomers more - and correct me if I am wrong in my
syntax).
I think it looks like this (based on section 1.3.4):
$TS['asdf'] = 'uiop'; // Without the dot
$TS['asdf.']['backgroundColor'] = 'blue';
$TS['asdf.']['backgroundColor']['transperency'] = '95%';

And the PHP Array would look like this:
$TS = array(
    'asdf' => 'qwerty',
    'asdf.' => array(
        'zxcvbnm' => 'uiop',
        'backgroundColor' => 'blue',
        'backgroundColor.' => array (
            'transparency' => '95%'
        )
    )
)
Is this correct?

Section 1.2.3 Conditions
You explain very well that it is possible to use 2 conditions OR'ed
together, but an example of using conditions that are AND'ed together would
be nice. This also shows that you can use inline conditions (If you can?)

And example could be if this is possible at all? (indented for readability):

# Only defined pageObj.20 HTML object once
pageObj.20 = HTML
[browser = netscape]
    [system = WinNT]
        pageObj.20 {
            value = Hello Netscape and Windows NT users!!
            value.case = upper
        }
    [else]
        pageObj.20 {
            value = Hello Netscape not on Windows NT users!!
            value.case = upper
        }
    [end]
[else]
    [system = WinNT]
        pageObj.20 {
            value = Hello Non-Netscape and Windows NT users!!
            value.case = upper
        }
    [else]
        pageObj.20 {
            value = Hellow Non-Netscape Non-Windows NT users!!
            value.case = upper
        }
    [end]
[end]

Also there is reference to the variables being evaluated (or objects or what
would you call these?):
browser: seems to return something that can check a part of HTTP_USER_AGENT
system: seems to return something that can check another part of
HTTP_USER_AGENT? (mine says Windows NT 5.1 as it is Windows XP... never saw
WinNT).
usergroup that contains the uid of a usergroup in Typo3.

Is there a list of these that are available for use (then a reference to a
document would be nice).

Section 1.2.4 Includes
Small and efficient, however reading newsgroups and other articles I was
looking for a way to do expanded nested menues for the entire tree. Someone
told me to use this TS code to include a PHP function from a file, and this
I did this way:
includeLibs.fakemenuitems = media/scripts/example_itemArrayProcFunc.php

Now I get the feeling that includeLibs is a library parsed somewhere in the
TS parsing process (probably by the template generator). Even though this
point is not just about TypoScript syntax I feel it perhaps is interesting
for section 1.3.4 (Parsing, Storing and Executing TypoScript) but I am a
little as to where it belongs as the name includeLibs imply some sort of
include mechanism...

Section 1.3.4 Parsing, Storing and Executing TypoScript
Hey - finally I found the TS $this->setup array!!! hmmm.. never saw it
anywhere else?
I believe this section should contain a little more info on when creating
extensions how the pageTS, userTS or template TS would overwrite values from
ext_typoscript_setup.txt (if they do... otherwise I have gotten it all wrong
as I believe that whatever in ext_typoscript_setup.txt are default values
made when using the Kickstarter and these can be automatically overwritten
in TS code inside Typo3).

Section 1.4.3 Implementing Conditions
The only thing I am not clear about is that if I implement my own
conditions, would that mean I would loose what ever is already implemented
in the template parser (or what it is that knows about "browser", "system",
"usergroup" etc.)

Phew!.. I guess that's it... Other than that I think I learned alot about
typoscript - but I feel I could learn it more clearly - so this is why I
wanted to review it.

Sincerely,
Dennis Petersen (fessorman)






More information about the TYPO3-dev mailing list