What is the best way to debug typoscript in the TYPO3 CMS?
Assuming I have a list, which is not displayed -
what is the strategy to look for the issue?
Debugging Typoscript is not the most comfortable task, but there are several possibilities. Here are the most common techniques:
- Use the TS Object Browser in the backend: Choose the Web > Template module, then pick the page from the pagetree you need to debug. If there are any obvious syntax errors or redundant/missing brackets, an error message will be displayed. Switch between constants and setup and use the search field extensively. In your example, search for the myListview parameter if your TypoScript object is named myListview.
- Use the Template Analyzer in the backend (also in Template module): It's similar to the Object Browser, but the Template Analyzer gives you valuable insights where in your setup the errors (or warnings) exactly are that have been spotted.
- Outsource your Typoscript setup (+ constants) to files, then use a syntax highlighter in your favorite text editor. You get a better overview and the highlighting helps to avoid misspellings. For example:
- PhpStorm TypoScript plugin (recommended combo)
- Netbeans TypoScript plugin
- Eclipse / Aptana: DEV3
- Coda: ts4c
- Textmate: Textmate Typoscript bundle
- PSPad: sweeTS
- jEdit: jEdit plugin
- Sublime Text: Textmate Typoscript bundle
- Activate the admin panel in the frontend and use the section "TypoScript". It shows you selected rendered (config) values, SQL queries, error messages and more. However, it's not complete and I'm not using it frequently so I am also keen on knowing more about it.
- Wrap your Typoscript objects with the
stdWrap.debugFunc
Function or use the build-in debugItemConf
method for all MENU
objects. Debug output will be seen in the frontend. Read more in the TYPO3 Wiki - Most common errors (apart from typos) are wrong file paths, non-existing HTML-templates or missing subparts in modified templates. Also, forgetting to include static templates for an extension might leave the intermediate user puzzled. Just as a starting point :).
Hope that helps, please post any additions into the comments.
The most important thing is, not to rely on code you found via google. Have a look into TSref and check what is possible.
Just some little additions which are easy to overlook (IMHO):
- The template analyser has an option: "View the complete TS Listing", so can search in the whole created typoscript! Including conditions.
- TS Object Browser: you can check conditions to simulate different situations
If you need to debug TypoScript configuration in the backend, go to the "Info"-Modul, select a page in the page tree and then select "Page TSconfig" in the main window. There you will get a info about Page TS Config.
These system extensions are usually installed, but they can be deactivated:
- tstemplate
- tstemplate_ceditor
- tstemplate_info
- tstemplate_objbrowser
- tstemplate_analyzer
- info_pagetsconfig (info modul)
- tsconfig_help (addition to the info modul)
It may happen, that someone else just deactivated them.