Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TYPO3: No template was found. View could not be resolved for action

I'm experimenting a bit with TYPO3 backend modules and I'm trying to get a view when I click my module in the left menu in the backend. However when I click this I get the following message:

Sorry, the requested view was not found. The technical reason is: No template was found. View could not be resolved for action "list" in class "MyVendor\MyModule\Controller\ConnectionController".

I have the view for the list action in the folder Resources/Private/Backend/Templates/Connection and the file is called List.html (uppercamelcase)

I'm using TYPO3 version 7.6.15 and I made this module with the extension builder.

Any help would be appreciated.

like image 892
Woeler Avatar asked Feb 14 '17 15:02

Woeler


1 Answers

Some possible reasons for this (or similar) errors:

1. Forgetting to include the TypoScript static templates

  • see Documentation: Include TypoScript from extensions

    1. Choose WEB > Template module (in Module menu)
    2. Select your start (root) page (in page tree)
    3. Select Info / Modify (in Docheader)
    4. Choose Edit the whole template record
    5. Choose tab Includes
    6. Select your extension under Available Items

This will activate the TypoScript under Configuration/TypoScript

enter image description here

2. Wrong path

The Template paths set via TypoScript must match the available template paths in the filesystem.

Usually, the default path is:

  • Resources/Private/Templates (for frontend plugins)

or

  • Resources/Private/Backend/Templates (for backend modules)

This must have been set correctly via TypoScript. For example:

Configuration/TypoScript/setup.typoscript:

# Module configuration
module.tx_myexample_web_myexamplelist {
    view {
        templateRootPaths.0 = EXT:myexample/Resources/Private/Backend/Templates/
...  
  • module. is for backend modules
  • if you are working with frontend plugins, use plugin. instead of module.
  • the correct file ending for TypoScript is .typoscript since TYPO3 8 and no longer .ts or .txt. For version 7, it is correct to use .ts.

3. Incorrect filenames

Make sure that the name of the Controller matches the name of the subdirectory in the Templates directory. The name of the template file is capitalized.

  • Controller/SomeController.php: listAction()

matches

  • Resources/Private/Backend/Templates/Some/List.html

Where to define the TS:

  • either as described above e.g. in Configuration/TypoScript setup.typoscript (and load this via static include).
  • The file ext_typoscript_setup.typoscript in the extension root can be used to setup TypoScript independent of page-tree and template-records. This will be included in the setup section of all TypoScript templates. but also consider the warning in the documentation.
  • Load TypoScript or TypoScript files directly in the extension with functions from ExtensionManagementUtility
like image 175
Sybille Peters Avatar answered Dec 18 '22 23:12

Sybille Peters