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

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.

Some possible reasons for this (or similar) errors:
1. Forgetting to include the TypoScript static templates
see Documentation: Include TypoScript from extensions
Choose WEB > Template module (in Module menu)
Select your start (root) page (in page tree)
Select Info / Modify (in Docheader)
Choose Edit the whole template record
Choose tab Includes
Select your extension under Available Items
This will activate the TypoScript under Configuration/TypoScript
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

You can also change your template root path (the relative path from where the extension takes the tempaltes):
go to the
setup.ts
file (or setup.txt file; depends on personal preferences and local configuration) and add the following line
plugin.tx_myslider.view.templateRootPath = EXT:path/to/custom/directory/
for example it could look like this:
EXT:slider/Resources/Private/Templates/myAwesomeFolder/
NOTE: slider is just a placeholder. You can simply replace it with your extension name

Add your extension to the website node. Until you add it, the setup.ts won't work.

Related

TYPO3: Where can I find the template created in the backend?

I'm trying to create separate templates for webpages with either a single or a double column structure. Currently my webpage only has one template, placed on the root page which is used by all its subpages.
However, I cannot find the template in myextension/Resources/Private/Templates as this folder is empty. Where is the template located in my extension and where should I add the alternative template?
I assume you use "fluid_styled_template"? Then the templates are in that respective core directory, in "Resources/Private".
If you want to manipulate them, copy them to your sitePackage into "Resources/Private/Extension/fluid_styled_content" (that at least is one of the recommended ways where to place it) and override the TypoScript that "fluid_stlyed_content" provides.
templateis not unique in TYPO3 context. we have:
typoscript records, maybe also as files which are included in a record or by PHP
HTML files, which are define a markup for parts of the website
they can be differed in
Marker-Templated. The old and less and less used kind with markers and subparts as placeholders for data defined in typoscript
Fluid templates. The modern kind with control structures and data objects
with the statemant
my webpage only has one template, placed on the root page
it is not clear what you mean:
records are defined in pages -> typoscript templates
maybe you mean in the root page a template is selected. that could mean HTML templates, probably fluid templates as the path myextension/Resources/Private/Templates matches the usual structure for fluid templates.
assuming fluid templates:
Templates are search in a list of folders. This list is managed in typoscript.
Any usage has it's own list and the list of your main/page template probably is at page.10.templatePaths. You can look for it in the TSOB (Typoscript Object browser)
If the list consists of one entry only you have only the basic config.
As the list of folders is consulted each time a template (,partial, layout) is accessed and only that file with matching name in the folder with highest priority is taken you can add your folders with higher numbers in the list so you do not need to change the original files (use copies in your folder to modify) or add files to the original folder (inside of other extensions).
So you need two things:
create your template file in an appropriate folder
(ext:myextension/Resources/Private/Templates sounds good)
and add this folder to the list of folders for these templates
(e.g. page.10.templatePaths.20 = EXT:myextension/Resources/Private/Templates)

TYPO3 8, Form extension - best practice for custom yaml files

When generating forms with the form module the corresponding yaml files get stored in fileadmin/user_upload.
Now I want to integrate those yaml files into my sitepackage and thus into my CVS. Where is the correct place for them? In the example extension they are stored in Resources/... while I would think they have to go into Configuration/Yaml
And how do I configure the form extension to search them in that place?
While it's basically a matter of taste where exactly one saves his form definitions, I try to separate form configuration and form definitions.
From the official documentation:
[...] the form configuration allows you to define:
which form elements, finishers, and validators are available,
how those objects are pre-configured,
how those objects will be displayed within the frontend and backend.
In contrast, the form definition describes the specific form,
including
all form elements and their corresponding validators,
the order of the form elements within the form, and
the finishers which are fired as soon as the form has been submitted.
Furthermore, it defines the concrete values of each property of the mentioned aspects.
So, for more clarity I save all form configuration in a sitepackage under Configuration/Yaml/ and the form definitions under Resources/Private/Forms, neighbouring the templates.
I wrote a full tutorial how to use custom templates with EXT:form, which also includes the answers to your question.
In short:
Register YAML configuration with TypoScript in your extension root folder as ext_typoscript_setup.txt (as recommended1)
plugin.tx_form.settings.yamlConfigurations {
100 = EXT:my_extension/Configuration/Yaml/CustomFormSetup.yaml
}
module.tx_form.settings.yamlConfigurations {
100 = EXT:my_extension/Configuration/Yaml/CustomFormSetup.yaml
}
CustomFormSetup.yaml – setting up a new storage path
TYPO3:
CMS:
Form:
persistenceManager:
allowedExtensionPaths:
10: EXT:my_extension/Resources/Private/Forms/
allowSaveToExtensionPaths: true
allowDeleteFromExtensionPaths: true
1TypoScript inside an ext_typoscript_setup.txt is automatically loaded in both frontend and backend of your TYPO3 installation directly after installing your extension. This differs from other TypoScript files, which have to be included manually, e.g. as static templates. See official Form Framework documentation.
I'd suggest Resources/Private/Forms for your form definitions. The form extension clarifies how to register additional form definition paths.

Order of Constants TS in Template Analyzer

i'm struggeling with the order of typoscript in constants. I've a provider extension holding all the templates and files for the site. Typoscript ist used in external files, i don't want to store typoscript in the database. I use typo3_forum ext and want to modify the templates to customize it. But when i put the ts for the view like:
plugin.tx_typo3forum {
view {
templateRootPath = EXT:provider/Resources/Private/Templates/Forum/Standard/
partialRootPath = EXT:provider/Resources/Private/Partials/Forum/Standard/
layoutRootPath = EXT:provider/Resources/Private/Layouts/Forum/Standard/
}
}
these values will be overwritten by the typo3_forum ext itself, cause the constants of typo3_forum ext stands in the templateAnalyser hirachy under my provider extension.
Sure storing the above ts in the constants field of my roottemplate solves the problem but is there no solution for external fiels to sort?
I've tried:
plugin.tx_typo3forum.view.templateRootPaths.100 = EXT:provider/Resources/Private/Templates/Forum/Standard/
but this doens't work, the ext uses the default template in that case.
Thanks for your help!
Cheers Mark
Put your line
plugin.tx_typo3forum.view.templateRootPaths.100 = EXT:provider/Resources/Private/Templates/Forum/Standard/
in the setup, not in constants.
You can move the path to constants like
Constants:
plugin.tx_typo3forum.view.myTemplateRootPath = EXT:provider/Resources/Private/Templates/Forum/Standard/
Setup:
plugin.tx_typo3forum.view.templateRootPaths.100 = {$plugin.tx_typo3forum.view.myTemplateRootPath}
If using TYPO3 version 8, take a look at https://forge.typo3.org/issues/75862. There is a bug regarding the fallback for template paths. The issue has been solved already and is targeted for version 8.4
The order of TS appearing in the template analyser simply reflects the order in which the files are loaded.
If you are already using a provider extension for your TypoScript and don't put any TS statements in the database (which is a good practice) you can go one step further and put no extension TS in the database at all (not even include static templates in the template record).
Just include the TypoScript files that you need in your provider extension with <INCLUDE_TYPOSCRIPT and you have complete control of the order of things.
In the database you have to put just one line in constants and one in setup, each of the including from your provider extension. This will also make you less dependent of the database because if you include a new file it is just loaded and no actions are needed in the actual template record in the backend.

Manage hierarchy / enforce priority of TS-templates

Well, there is actually another guy with exact the same problem. But until today, they didn't come up with a solution, that's why I'm asking it once again.
My entire TS is included by an extension in TYPO3 7.6.8. This works fine except with indexed_search. The TS inside my resources EXT get overwritten by the indexed_search default TS.
This is the order of the TS inside the Template-Analyzer:
SYS: TYPO3_CONF_VARS:FE:defaultTypoScript
EXT:fluid_styled_content/Configuration/TypoScript/...
... a bunch of other third party extensions ...
EXT:indexed_search/Configuration/TypoScript
EXT:templates_ext/Resources/Private/TypoScript
extbase
fluid
extensionmanager
belog
beuser
felogin
indexed_search
sys_note
realurl
So #7 is the extension which includes all my TS but it gets overwritten by #14. The only way to configure the indexed_search is inside the setup of the page template (which comes after all those above). But I want to avoid that to keep things clean.
Is there a way to prioritize a certain TS so that it doesn't get overwritten?
Open the TypoScript record, switch to the tab "Includes", at the bottom you will find the field Static Template Files from TYPO3 Extensions:. Select the value Include before all static templates if root flag is set.
Try putting the TS from your template extension inside the root page Setup field like this (adjust the path if necessary, your example says Resources/Private/TypoScript?):
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:templates_ext/Configuration/TypoScript/setup.ts">
This should make sure that it is included AFTER all the other includes (I assume you included those via the includes tab?)

Template could not be loaded in TYPO3 extension

Am using a new extension build in TYPO3 V4.5.0 and after it installed it in TYPO3 V6.2.x it shows the following error
The template files "/var/www/dev/typo3/typo3conf/ext/my_ext/Resources/Private/Layouts/Suche.html", "/var/www/dev/typo3/typo3conf/ext/my_ext/Resources/Private/Layouts/Suche" could not be loaded.
The layout i s present in the location. and path given also correct in backend..
How can i fix this?
Check so template filename has first letter uppercase.
The rule is that for action named fooBarAction() template file must be named FooBar.html