Manage hierarchy / enforce priority of TS-templates - typo3

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?)

Related

TYPO3 9.5.15 with gridelements and t3sbootstrap not working

I have a new TYPO3 9.5.15 installation and added gridelements 9.5.0 and t3sbootstrap 4.4.5 to make content elements with 3 columns in a own 1 column backendlayout which is defined in PageTsConfig.
In older TYPO3 versions, this is working fine (i.e TYPO3 7) but in TYPO3 9 I get the following error in FE:
Tried resolving a template file for controller action "Standard->three_columns" in format ".html", but none of the paths contained the expected template file (Standard/Three_columns.html). The following paths were checked:
xxx/typo3/sysext/fluid_styled_content/Resources/Private/Templates/, xxx/typo3conf/ext/gridelements/Resources/Private/Templates/, xxx/typo3conf/ext/t3sbootstrap/Resources/Private/Templates/Content/, xxx/typo3conf/ext/t3sbootstrap/Resources/Private/Templates/, ,
I've double checked and can confirm, that both, gridelements and t3sbootstrap are included in the roottemplate of the website.
As far as I found out, the templates are available in xxx/typo3conf/ext/t3sbootstrap/Resources/Private/Templates/Gridelements/
but are called ThreeColumns.html
Has anyone an idee what causes the error and how to resolve it?
Thanks in advance
At a first look it seems that there are 2 problems with your combination here:
The message "Standard->three_columns" points to a wrong static template, so I guess you included the new DataProcessing static of Gridelements, while t3sbootstrap depends on the old Plugin and USER based static.
The root path xxx/typo3conf/ext/t3sbootstrap/Resources/Private/Templates/Gridelements/ is missing in your setup.
At a second look it might even be enough to change the Gridelements static, since t3sbootstrap takes care of the root path based on that setup.

How to get the Log In Form on every page? (for example in footer) Typo3

Is there a way to get the Log In Form for Frontend User on every page? I would prefer the footer.
And if someone is logged in you can see the Log Out Button.
Is this possible without an extension?
You can copy the default felogin output to wherever you want on your template. For example use lib.login, copy the plugin.tx_felogin_pi1 into it, change the template and you're fine.
lib.login < plugin.tx_felogin_pi1
lib.login.templateFile = path/to/your/template/file
More you can see in the official documentation: https://docs.typo3.org/typo3cms/extensions/felogin/8.7/Configuration/Index.html
In general there are three options to include a CE (e.g. the Login-form) on all pages:
use typoscript to generate the CE. Normally the CEs are defined in tt_content, from where you could copy the base configuration and adapt it. For some plugins you also find a complete configuration beyond lib (for newer extensions there you only find the settings). All the configuration must be done in typoscript.
use typoscript to render the content of a special page/ column. In this variant you have a special page only for content referenced somewhere else. Advantage: you could configure the CE in the usual way. Try to avoid referencing CEs by uid as an editor might disable or delete the current element(s) and insert a new one which would not be rendered.
use a special column in your root page and inherit the content to all subpages. Advantage: you could change the inherited content easily on each page (if this column is available in the current backend layout).
example for 3:
variables {
footer_content < styles.content.get
footer_content.select.where = colPos = 15
footer_content.slide = -1
}

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.
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.

TYPO3 Extbase: Set storagepid for Backend Module

I have written a small extension that provide news for Backend User.
Ist is just 2 Parts. One part showing the news for all BE User as a own Module, and the other part are create and edit functions provided by the TCA.
To work with the TCA forms and the default extbase getter, i need the correct storagePid. I can't set them via TypoScript, because I'm never in a page context.
My Idea was to use the Plugin settings with the file ext_conf_template.txt
# cat=persistence/enable; type=int; label=Storage pid
storagePid = 4457
But how can I tell TYPO3 to look at this Settings?
At least Repository->findAll() must respect it
Normally you would define this using TypoScript:
module.tx_yourextensionkey.persistence.storagePid = 123
Not being in a page context is not a blocker as long as you place the configuration on the first root TypoScript template (or include the TypoScript via other means which cause global inclusion not specific to any sys_template record or page tree location).
Maybe not the best solution, but it works.
I have written my own function in the repository with the pid as parameter.
I'm using the TYPO3 Query builder.
With $query->equals('pid', $pid); I get entries with my pid.
And with $query->getQuerySettings()->setRespectStoragePage(false); the default pid will be ignored.
And as the last step. My Controller gets the pid from the Settings, unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['my_extension']['storagePid']); an gives it to the function.

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.