I want to add custom content elements on the container "Inhaltselemente".
The textmedia element and several other elements works.
But if i add a custom comtent eleemnt from my own extension, or from mask export i get the following error:
"Wert ist nicht erlaubt"
the HTML CE also does'nt work.
see also screen
Check your rights configuration and your PageTS settings on the news folder.
Look for something like:
TCEFORM.tt_content.CType {
removeItems := addToList(html)
}
This will at least trigger the message you see above.
Related
TL;DR:
The Backend Layouts of the site package tutorial (Default/Standard and Two Columns) do not show up for new pages in Appearance -> Backend Layout. The error message in this thread (1.html) is an artefact of prior Backend Layouts which came from the original old site setup.
Solution:
To make the Backend Layouts of the site package tutorial show up there, I had to edit the root page of the site: Resources -> Include static Page TSconfig (from extensions) and add site-package from the Available Items list.
This can also be achieved without "Resources -> Include static Page TSconfig (from extensions)" but via file ext_localconf.php in the root of the site package extension (gpcf_theme):
<?php
defined('TYPO3_MODE') || die();
$boot = function (string $_EXTKEY): void {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:'.$_EXTKEY.'/Configuration/TsConfig/Page/Page.tsconfig">
');
};
$boot('gpcf_theme');
unset($boot);
Original Question:
I'm still trying to bring an existing (older) web page into Typo3 11 following the TYPO3 Sitepackage Tutorial.
Currently I get an
"Oops, an error occurred! Code: 202111161210589c32f8c0"
and can't get rid of it whatever I do.
The corresponding entry in the log files is (line breaks added by me):
../../var/log/typo3_61306f633c.log:Tue, 16 Nov 2021 12:10:58 +0000 [ALERT] request="30cc4e082c853"
component="TYPO3.CMS.Frontend.ContentObject.Exception.ProductionExceptionHandler":
Oops, an error occurred! Code: 202111161210589c32f8c0- InvalidTemplateResourceException:
Tried resolving a template file for controller action "Standard->1" in format ".html",
but none of the paths contained the expected template file (Standard/1.html).
The following paths were checked:
/var/www/html/typo3_11/public/typo3conf/ext/gpcf_theme/Resources/Private/Templates/Page/,
in file /var/www/html/typo3_11/vendor/typo3fluid/fluid/src/View/TemplatePaths.php
I can't find the reason of this error, because I have no idea, where the needed template Standard/1.html is requested from.
Is this some kind of hard coded default if nothing else is found?
If this is the case, the real problem is, that my customizations to the Sitepackage Tutorial source code seems to be wrong, but it never produced any different error despite the above one, which isn't really helpful. Ok, this is speculation, because I don't know.
As you can see, the site package was renamed to gpcf_theme, it's available in the backend and applied as root template to the site. No other template is active (AFAIK). A simple newly created test page creates above error.
If I uncomment in Configuration/TypoScript/Setup/Page.typoscript the lines so that:
page = PAGE
page {
typeNum = 0
10 = TEXT
10.value = Hello World!
}
same error, no hello world.
Any idea how to locate the reason for my misery?
Maybe the fix is really simple. Try to go into the backend:
Edit the homepage
To to the "Appearance" tab
Set the Backend Layout for this and subpages
Save your change
There is a good chance that it is working now.
Whats going on?
You can cast this query on your database:
SELECT
uid, pid, title, backend_layout, backend_layout_next_level
FROM
pages;
Here you get a list of pages, some with backend_layout and backend_layout_next_level filled. Most likely your home pages has some values in this fields?
The value of this field is generated by the TSConfig for backend layouts you set in:
https://docs.typo3.org/m/typo3/tutorial-sitepackage/11.5/en-us/ContentMapping/Index.html#dynamic-content-rendering-in-typoscript
This column is then read and processed in your TypoScript:
https://docs.typo3.org/m/typo3/tutorial-sitepackage/11.5/en-us/TypoScriptConfiguration/Index.html#part-1-fluid-template-section
It is explained below the code snippet.
If the 4 steps from the beginning of my answer did not solve your problem, then this are the places to look.
In TSConfig is the definition of the backend layouts, columns, labels and what is written in the pages.backend_layout db-field
DB columns if the value makes sense pagets__<yourTemplateName>
The TypoScript that reads this db-field cuts of the pagets__ takes the rest, adds .html and searches in the paths defined in the TypoScript below.
check if the Folder and Filename of your Template file are correct.
the error message states that the file 1.html is expected in the folder /var/www/html/typo3_11/public/typo3conf/ext/gpcf_theme/Resources/Private/Templates/Page/
as you noted that you have renamed the site package you may have missed some occurrences of the original package name and so some configuration is missing or pointing to nirvana.
The divider content element is disabled for all pages via TCEFORM.tt_content.CType.removeItems := addToList([…], div) in PageTSconfig. This works just fine.
Now I want that the divider is only available for a certain subset of pages.
I defined the uppermost page in my site configuration which leads to the following Typoscript:
[site("configuration")["settings"]["pages"]["simpleLanguage"] and site("configuration")["settings"]["pages"]["simpleLanguage"] in tree.rootLineIds]
TCEFORM.tt_content.CType.removeItems := removeFromList(div)
[END]
Now when I want to insert an divider on that given pages, I can choose it from the NewContentElement Wizard, but when the form of the content element gets rendered the divider is missing in the CType select.
Divider is shown in NewContentElement Wizard
But not in the content element form.
I found out that when setting the pageuid directly, the condition is evaluated fine.
So my conclusion ist that I cannot get site information inside TSconfig.
So how can I get the information from the site config inside TSconfig?
Conditions in PageTS have been fixed for TYPO3 v10 with https://forge.typo3.org/issues/89718.
The patch has not been backported to v9 due to its complexity.
The new content element wizard uses another configuration:
https://docs.typo3.org/m/typo3/reference-tsconfig/master/en-us/PageTsconfig/Mod.html#newcontentelement-wizarditems
# PageTS
# CType "div" is in group "special"
mod.wizards.newContentElement.wizardItems.special.show := removeFromList(div)
Is there a way to hide content elements on content add that aren't being used anyway?
what kind of users should not see them?
Usual users solution
Create a backend user group an remove all the unwanted elements from their rights
Find the official manual for that in TYPO3 Documentation
Global solution
Remove them by editing Page-TSConfig like this:
TCEFORM.tt_content.CType {
removeItems = header, text, textpic, image, bullets, table, uploads, media, mailform, search, login, menu, shortcut, html, script, splash, div, list
}
see documentation https://docs.typo3.org/m/typo3/reference-tsconfig/main/en-us/UsingSetting/Index.html, how to set TSConfig
see documentation how to change the View of the TYPO3-backend with TSConfig
https://docs.typo3.org/m/typo3/reference-tsconfig/main/en-us/PageTsconfig/TceForm.html
To prevent configuration-conflicts with other extensions use the TSConfig-function addToList in Page-TSCsconfig. List of Content-Elements in TYPO3 11:
TCEFORM.tt_content.CType {
# dont remove contentelement 'textmedia'
# remove the other Contentelements in TYPO3 11
removeItems := addToList(header, text, textpic, image, bullets, table, uploads, menu_abstract, menu_categorized_content, menu_categorized_pages, menu_pages, menu_subpages, menu_recently_updated, menu_related_pages, menu_section, menu_section_pages, menu_sitemap, menu_sitemap_pages, form_formframework, felogin_login, shortcut, list, div, html)
}
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
}
new here, and also new to TYPO3.
I need to put something like [imagebox, title='box1'] into content editor and that will be replaced by a text and image with some javascript effect (text and image are managed in the DB elsewhere, the tag is just for the placement in the page).
I've read that TYPO3 has a mechanism for adding custom tags and I managed to make them accepted in the RTE.
I tried instead of [imagebox..... to use
<imagebox>box1</imagebox>
with something like this (copied from web):
tt_content.text.20.parseFunc.tags {
imagebox < lib.parseFunc.tags.link
imagebox = TEXT
imagebox.value= replaced
# imagebox = PHP_SCRIPT
# imagebox {
# stripNL = 0
# Pass a parameter from Typoscript to a PHP script:
# UID of the page containing the SINGLE view of tt_news
# id_singleView = 18
# Call the PHP script
# file = fileadmin/scripts/imagebox_parser.php
# }
}
lib.parseFunc.tags.imagebox < tt_content.text.20.parseFunc.tags.imagebox
should be able to replace content between tags.
I've commented call to php function just tried to get a text replacement for starters.
I've put that in the main root template Setup, but nothing is replaced.
I've also tried other examples from the web with no success.
Did anyone have situation like this?
Are there better approaches for that in TYPO3? (I'm using v7.6.23)
Any suggestion or hint is appreciated.
EDIT: using FSC on textmedia element
I think your examples are outdated. (the object PHP_SCRIPT is obsolete for a long time)
You might have a look at the documentation for your TYPO3 version:
https://docs.typo3.org/typo3cms/TyposcriptReference/7.6/Functions/Parsefunc/
you also need to enhance the parsefunc where you need it. That can depend on:
CSC or FSC?
which kind of content element (CE) do you use? (be sure to enhance the rendering of that CE)