InterviewSolution
| 1. |
Explain Typoscript Syntax? |
|
Answer» TypoScript is parsed in a very simple way; line by line. This MEANS that each line normally contains three parts based on this formula: [Object Path] [Operator] [Value] object path: The object path (in this case myObject.myProperty) is like the variable name in a programming language. The object path is the first block of non-WHITESPACE characters on a line until one of the characters =<>{( or a white space is found. The dot (.) is used to separate objects and PROPERTIES from each other creating a HIERARCHY. Here we have the object myObject with the property myProperty. Use only A-Z, a-z, 0-9, “-“, “_” and periods (.) for object paths! Dots in the object path can be escaped using a backslash. operator: The operator (in the example it is =) can be one of the characters =<>{(. The various operators are described below. value: The value (in case of the above example “value 2”) is whatever characters FOLLOW the operator until the end of the line, but trimmed for whitespace at both ends. Notice that values are not encapsulated in quotes! The value starts after the operator and ends with the line break. Comments: When a line starts with / or # it is considered to be a comment and will be ignored. Comment blocks: When a line starts with /* or */ it defines the beginning or the end of a comment section respectively. TypoScript is parsed in a very simple way; line by line. This means that each line normally contains three parts based on this formula: [Object Path] [Operator] [Value] object path: The object path (in this case myObject.myProperty) is like the variable name in a programming language. The object path is the first block of non-whitespace characters on a line until one of the characters =<>{( or a white space is found. The dot (.) is used to separate objects and properties from each other creating a hierarchy. Here we have the object myObject with the property myProperty. Use only A-Z, a-z, 0-9, “-“, “_” and periods (.) for object paths! Dots in the object path can be escaped using a backslash. operator: The operator (in the example it is =) can be one of the characters =<>{(. The various operators are described below. value: The value (in case of the above example “value 2”) is whatever characters follow the operator until the end of the line, but trimmed for whitespace at both ends. Notice that values are not encapsulated in quotes! The value starts after the operator and ends with the line break. Comments: When a line starts with / or # it is considered to be a comment and will be ignored. Comment blocks: When a line starts with /* or */ it defines the beginning or the end of a comment section respectively. |
|