If you study the static_template, especially "content (default)", you'll see an extensive use of objects from "styles.content.[xxx]".
First of all you must understand, that the toplevels object named "temp" and "styles" are totally unset after a template has been parsed and "compiled" (by serialize()) for storage in the template-cache (cache_hash). The reason why is, that sometimes it's very useful to reuse an object many places in a TypoScript. Creating the object somewhere inside styles. or temp. has the advantage that the objects can be copied from there in your scripts but are finally wiped out to save some space in the cached template.
You should use "temp." for your own common objects. "styles." is reserved for use by the static_templates to provide common used objects.
# CType: image
tt_content.image = COA
tt_content.image {10 = < lib.stdheader
20 < styles.content.imgtext
}
In this example a object from the static_template "styles.content (default)" is copied to the position "tt_content.image.20". That looks like this in the object browser:
Looking in the static_template "styles.content (default)" we see that the object "styles.content.imgtext" is defined like this:
# imgtext
styles.content.imgtext = IMGTEXT
styles.content.imgtext {imgList.field = image
textPos.field = imageorient
imgPath = uploads/pics/
imgObjNum = 1
1 {file.import.current = 1
file.width.field = imagewidth
params = align="top"
imageLinkWrap = 1
....
}
maxW = {$styles.content.imgtext.maxW}maxW.override.data = register:maxImageWidth
....
}
Now, if I want to change the value of "styles.content.imgtext.maxW" to "400", then I have two options. But a very common error here is to try this:
styles.content.imgtext.maxW = 400
See, this will not help you anywhere. The reason is that this changes the value in the object "styles.content.imgtext" and not in " tt_content.image.20" where it's ultimately used in this case. So you can do one of the following.
1) Because "styles.content.imgtext" is copied to "tt_content.image.20" by the "<" operator of TypoScript, any properties of "styles.content.imgtext" are now in "tt_content.image.20" also. Therefore you can change the value this way:
tt_content.image.20.maxW = 400
This is kind of obvious according to the nodetree of the object browser, isn't it?
2) If you change the value of "styles.content.imgtext.maxW" directly, you must also re-copy it to the proper position of it's use:
styles.content.imgtext.maxW = 400
tt_content.image.20 < styles.content.imgtext
This works also, but be aware that this clears any previous changes made to "tt_content.image.20" (in the manner of method 1 in this example)
I recommend method 1.
Anyway you must be aware that the fine advantage of "styles.content.[xxx]" objects is that they provide default properties that may be used throughout your template. So changing "styles.content.[xxx]" and recopying it one place doesn't bring the change to the other objects that has been based on "styles.content.[xxx]".
For an example, consider " tt_content.textpic.20" which also uses "styles.content.imgtext":
tt_content.textpic = COA
tt_content.textpic {10 = COA
10.if.value = 25
10.if.isLessThan.field = imageorient
10.10 = < lib.stdheader
20 < styles.content.imgtext
20.text.10 = COA
20.text.10 {if.value = 24
if.isGreaterThan.field = imageorient
10 = < lib.stdheader
}
20.text.20 = < tt_content.text.20
}
So in order to change the value here also you must add this line:
tt_content.textpic.20.maxW = 400
Now, could you right away do this?
styles.content.imgtext.maxW = 400
tt_content.image.20 < styles.content.imgtext
tt_content.textpic.20 < styles.content.imgtext
The answer is "no" in this case, because if you take a look at the TypoScript for tt_content.textpic, the properties of styles.content.imgtext is altered after the object is copied:
...
20 < styles.content.imgtext
20.text.10 = COA
20.text.10 {
if.value = 24
if.isGreaterThan.field = imageorient
10 = < lib.stdheader
}
20.text.20 = < tt_content.text.20
...
This situation is generally solved by using the widely implemented constants, and in this specific case you have the opportunity of changing the constant "styles.content.imgtext.maxW".