Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.
| Nächste Überarbeitung | Vorherige Überarbeitung | ||
| typo3:about:constants [2014/01/12 18:24] – angelegt admin | typo3:about:constants [2015/06/03 20:16] (aktuell) – admin | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| ====== Constants ====== | ====== Constants ====== | ||
| Konstanten werden im Constants-Feld eines Typoscript-Templates angelegt. Auf diese Weise können im Setup Platzhalter für sich wiederholende Wertangaben gesetzt werden. Diese Werte lassen sich nun an zentraler Stelle ändern. | Konstanten werden im Constants-Feld eines Typoscript-Templates angelegt. Auf diese Weise können im Setup Platzhalter für sich wiederholende Wertangaben gesetzt werden. Diese Werte lassen sich nun an zentraler Stelle ändern. | ||
| + | |||
| + | Konstanten können auch im Constants-Feld verwendet werden (siehe Anwendungsbeispiele). | ||
| + | |||
| ---- | ---- | ||
| - | ===== Eigene Variablen zum Konstanteneditor hinzufügen | + | |
| - | [[typo3: | + | ===== Anwendungsbeispiele |
| - | ---- | + | |
| - | ===== baseURL, pathToTemplates, | + | ==== Generell |
| **Anlegen in Constants: | **Anlegen in Constants: | ||
| <code typoscript> | <code typoscript> | ||
| - | mypage | + | # Mit oder ohne Top Level Object: |
| + | myConf | ||
| baseURL = http:// | baseURL = http:// | ||
| - | pathToTemplates = fileadmin/ | ||
| - | pathToImages = fileadmin/ | ||
| } | } | ||
| + | pathToTemplates = fileadmin/ | ||
| + | |||
| </ | </ | ||
| - | **z.B. Verwendung in Setup:** | + | |
| + | **Verwendung in Setup:** | ||
| <code typoscript> | <code typoscript> | ||
| - | config.baseURL = {$mypage.baseURL} | + | config.baseURL = {$myConf.baseURL} |
| + | page.includeCSS.mainCSS = {$pathToTemplates}main.css | ||
| + | </ | ||
| + | ---- | ||
| + | |||
| + | ==== Konstanten im Constants-Feld verwenden ==== | ||
| + | |||
| + | **Anlegen in Constants: | ||
| + | <code typoscript> | ||
| + | domain = www.example.org | ||
| + | baseURL = http:// | ||
| </ | </ | ||
| - | **z.B. Verwendung in Setup:** | + | |
| + | **Verwendung in Setup:** | ||
| <code typoscript> | <code typoscript> | ||
| - | page.includeCSS.file1 | + | config.baseURL |
| - | page.10 | + | [globalString |
| - | page.10 { | + | ... |
| - | template = FILE | + | [global] |
| - | template.file | + | |
| - | workOnSubpart = DOCUMENT_BODY | + | |
| - | marks { | + | |
| - | HEADER = IMAGE | + | |
| - | HEADER { | + | |
| - | file = {$mypage.pathToImages}header.jpg | + | |
| - | wrap = <a href=" | + | |
| - | } | + | |
| - | } | + | |
| </ | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Dies funktioniert nicht ==== | ||
| + | |||
| + | Das Auslesen von Konstanten innerhalb einer Condition im Constants-Feld: | ||
| + | <code typoscript> | ||
| + | domain = www.example.org | ||
| + | [globalString = IENV: | ||
| + | ... | ||
| + | [global] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Eigene Variablen zum Konstanteneditor hinzufügen ===== | ||
| + | |||
| + | [[typo3: | ||