Laravel Backpack PageManager - Can't add page (Field 'template' doesn't have a default value) - laravel-backpack

Trying to add a new page in a Laravel BackPack project, using the PageManager addon gives the following error:
SQLSTATE[HY000]: General error: 1364 Field 'template' doesn't have a default value
Expanding the Ignition error message shows the following:
INSERT INTO
`pages` (
`name`,
`title`,
`slug`,
`content`,
`extras`,
`updated_at`,
`created_at`
)
VALUES
(
dghj,
fghj,
fghj,
?,
{ "meta_title": NULL,
"meta_description": NULL,
"meta_keywords": NULL },
2022 -09 -12 16: 19: 59,
2022 -09 -12 16: 19: 59
)
...there's no sign of a template in this query but (I believe) it should be added by the PageManager addon so isn't something I have control of.
None of the frames in Ignition show files I've worked on, they're all illuminate or vendor files, however I've set up a new base app containing Laravel, Backpack and Backpack PageManager only, which works as expected so I don't think this is a bug in a package. I'm at a loss as to what I've done wrong or how to go about finding/resolving the problem.
Further info:
Selecting a template in the CRUD view DOES prompt the JS pop-up 'Are you sure you want to update the page template', confirming DOES update the URL to include the GET parameter e.g. [domain]/admin/page/create?template=standard
PHP Version: 8.1.9
Backpack version: 5.3.12
I also have the MenuCRUD addon installed which is reliant upon PageManager and is working as expected.

I managed to find the issue.
For whatever reason a view had been published to resources\views\vendor\backpack\crud\fields\select_page_template.blade.php
This file included:
<select class="form-control" id="select_template" name="select_template" ... >
Changing the name to 'template' resolved the issue:
<select class="form-control" id="select_template" name="template" ... >
Neither of these variations match what's in the original version of the file here, which doesn't even include a name attribute on the input. I'm not sure why mine does, but is all seems to be working now so I'll let sleeping dogs lie and leave this page up in case it benefits anybody else.

Related

TYPO3 11 Sitepackage Tutorial expected template file Standard/1.html

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.

TYPO3 - "No pseudo-site found in root line of page [uid]" when create new sys_category

TYPO3 9.5.15
When I edit an existing category and than click the "+new" button inside the edit form, i will get the error:
#1534710048 TYPO3\CMS\Core\Exception\SiteNotFoundException
No pseudo-site found in root line of page 17
Page 17 in this case is absolute incorrect - this is the uid of the sys_category from which editing form I came from. the categories were saved on pid:6
I can do the same task from other category edit-forms, but not from all. I cannot figure out what is the difference of the categories where it doesnt work.
The basic site-configuration is configured and working, there is only one language, no workspaces.
Has anyone ever had a similar problem?
Side note: It still "works" for records which have the same uid as a pages record. It also "works" for L>0 records because they still fall back to 0.
However, this is not a core bug but a misuse of the internal DisplayCond by 3rd party extensions.
E.g. in the latest tt_address this is already fixed, see: https://github.com/FriendsOfTYPO3/tt_address/commit/4501d1f30f3381a235e447567018e6d5646ec069
So changing the TCA DisplayCond of the sys_category slug in my own extension did the trick in my setting
'displayCond' => 'VERSION:IS:false',

Why my frontend empty with automaketemplate after migration?

I have an empty <body> after migration from typo3 4.5 to 6.2.10.
Hello world in body works but with the typoscript with the extension automaketemplate there is an empty body tag. Anybody have an idea why ?
Thank you very much in advance.
Mohamed
After Migration Follow this step:
1) Upgrade all the compatible extension and disable those extension which is not compatible.
2) Check the typoscript , some of typoscript has been removed in 6.2 version. need to removed or need to replace with latest.
3) Check the install tool > upgrade wizard. is there anything that remaining to be execute ?
For error debug :
Add this into LocalConfiguration.php under the 'sys'
'debug' => '1',
'displayErrors' => '1',
'enable_DLOG' => '1',
'enable_errorDLOG' => '1',
'enable_exceptionDLOG' => '1',
#Mohamed Masmoudi : Just add the debug code in your Localconfiguration.php. that will show the error which not loading frontend.
I hope this things helps.
I had the same issue. In my case, the extension css_styled_content was not installed and selected in TS. After that it worked fine.
I have this in the admin panel :
Setting language and locale 9 Locale "de_DE" not found.
Page generation 40
page PAGE 60 Content Object "" does not exist
Content Object "" does not exist
Content Object "PHP_SCRIPT" does not exist
Include libraries
page 6 Files for inclusion: "typo3conf/ext/automaketemplate/pi1/class.tx_automaketemplate_pi1.php"
Include libraries
page 1 Files for inclusion: "typo3conf/ext/automaketemplate/pi1/class.tx_automaketemplate_pi1.php"
Page generation/XHTML clean, all 10
Page generation/Local anchor fix, all 0
Print Content 5

TYPO3: Duplicate content elements and fields after Flux 6.0.x update

Since updating from Flux 6.0.2 to the newest Flux TER-Release (7.0.0) I have the problem that all my defined flux:field.select items are switched. I have them defined as an array like this items="{0: {0: 'value shown as a CSS class in the frontend',1: 'value shown in BE'},}". But now I get the BE value in the frontend template.
Also all my content elements from my provider extension are shown twice (without a title) in the backend and the fields defined in the 'Configuration' section of my content element are shown twice.
There's also a RTE field shown at the bottom of my content element that has not been there before.
BE Output: view
Code on Pastebin: http://pastebin.com/CNcphn2k
Any help deeply appreciated.
EDIT:
I just set up a fresh instance of TYPO3 6.1.9 (blank package) and installed my extension with the above mentioned content elements. Dependencies were resolved automatically as it should (newest versions). Via the content wizard I tried to create a new element and I get the same result as in my existing install I first noticed this bug in.
EDIT2:
I was able to narrow it down to the flux:form.container tag. This duplicates the output in the BE. The select values are still switched though.
It is possible that you missed this official announcement:
http://fluidtypo3.org/blog/news/new-colpos-value.html
Failure to run the update script before letting TYPO3 change the type of the colPos value will result in the symptoms you describe. There is, unfortunately, no way to restore this (since your SQL will have cropped off all negative values and made them zero without any backup).
Restore from a backup and run the script and you should be fine.

TYPO3/TemplaVoila: Unknown column 'belayout' in 'field list' when adding new Template Object

We're trying to implement a mobile version of our Typo3 site, but whenever I add a new Template Object and select something in "Make this a sub-template of", I get this error:
I'm not very good with typo3, so if anyone could point me in the right direction it would be great. Thanks.
Go to Install Tool > Database Analyser > COMPARE and mark the checkboxes to add missing fields and tables (you don't need to remove suggested things)
Repeat the operation as long as required, if some field can not be added by COMPARE, you need to include it manually via phpMyAdmin. Most probably in such case you'll need to resolve some conflict.
Next go to Extension Manager, find the TemplaVoila ext and search for Update button, to make sure that the config is saved correctly to the file.