TYPO3 How to overwrite blog extension in custom extension - typo3

I tried this, in my extension's setup.typoscript. but is not work for me.
plugin.tx_blog {
view {
layoutRootPaths = EXT:solution/Resources/Private/Extensions/Blog/Layouts/
partialRootPaths = EXT:solution/Resources/Private/Extensions/Blog/Partials/
templateRootPaths = EXT:solution/Resources/Private/Extensions/Blog/Templates/
}
}

all the "RootPaths" are arrays so change it to somting like this
plugin.tx_blog {
view {
layoutRootPaths.200 = EXT:solution/Resources/Private/Extensions/Blog/Layouts/
partialRootPaths.200 = EXT:solution/Resources/Private/Extensions/Blog/Partials/
templateRootPaths.200 = EXT:solution/Resources/Private/Extensions/Blog/Templates/
}
the "200" in the examle is the position if Fluid is looking for a Resource (like a template) it will check every provided path in numerical order.
use the Typoscript Object Browser (in the Template Module) to check the configured RootPaths

The standard setup of that extension is a bit uncommon.
The easiest was to override the paths for fluid files is to use the constant editor. There you have fields where you can enter your own paths.
If you want to do it in the setup, you can look in the TypoScript setup of the extension that looks like shown below.
page = PAGE
page {
typeNum = 0
10 = FLUIDTEMPLATE
10 {
templateName = BlogList
templateRootPaths {
0 = EXT:blog/Resources/Private/Templates/Page/
1 = {$page.fluidtemplate.templateRootPath}
}
partialRootPaths {
0 = EXT:blog/Resources/Private/Partials/Page/
1 = {$page.fluidtemplate.partialRootPath}
}
layoutRootPaths {
0 = EXT:blog/Resources/Private/Layouts/Page/
1 = {$page.fluidtemplate.layoutRootPath}
}
...
So in a short block the the paths would look like this:
page.10.templateRootPaths {
0 = EXT:blog/Resources/Private/Templates/Page/
1 = {$page.fluidtemplate.templateRootPath}
}
page.10.partialRootPaths {
0 = EXT:blog/Resources/Private/Partials/Page/
1 = {$page.fluidtemplate.partialRootPath}
}
page.10.layoutRootPaths {
0 = EXT:blog/Resources/Private/Layouts/Page/
1 = {$page.fluidtemplate.layoutRootPath}
}
In the lines starting with 1 you can enter your own path if you never want to use the constants. For this you never have to enter it in the original TypoScript template, but just copy the block above in your own TypoScript and adjust the paths. If your TypoScript is loaded after that of the blog, it's overwriting the original values.
Take care that there exist different setups, one in each folder inside https://github.com/TYPO3GmbH/blog/tree/master/Configuration/TypoScript. So depending on the template you chose the setup must be different. But I hope you're able to adapt the way to go now.

Related

Typo3 10.4.4 Gridelements 10.0.0 extension not working

Hey I am pretty new to typo3 and I want to build a website.
I am running version 10.4.4 of TYPO3 with the bootstrap package installed.
I have tried to follow the guide on https://docs.typo3.org/typo3cms/extensions/gridelements/stable/
I have copied the TypoScript into my template setup, but there is no output on the frontend.
Remember I am new to this so I don't understand the TypoScript well yet.
So any ideas to what I could do?
EDIT:
I want to use GriElements so that I can create my own layouts on my page. The standard layouts are good but I need more freedom than what they offer.
I can get output on the frontend without GridElements, but when I use the extension only the content in the GridElements block wont show. If I remove the standard TypoScript from the example on the manual page for this extension i get an error saying "Oops an error occurred! Code:" and then a code that changes every time I update the page.
My TypoScript on my template looks like this:
page.includeCSS.1 = fileadmin/user_upload/template/css/fonts.css
page.includeCSS.theme = fileadmin/user_upload/template/css/custom-theme.scss
# plugin.tx_bootstrappackage._LOCAL_LANG.da.readmore = test (NOT WORKING)
# https://docs.typo3.org/m/typo3/reference-coreapi/10.4/en-us/ApiOverview/Internationalization/ManagingTranslations.html
page.meta.robots = noindex, nofollow
page.meta.robots.replace = 1
page.10.partialRootPaths.3 = fileadmin/user_upload/template/partials/ContentElements/
page.10.partialRootPaths.4 = fileadmin/user_upload/template/Partials/Page/
page.10.dataProcessing.10.levels = 3
page.includeJSFooterlibs.bootstrap_navbar = fileadmin/user_upload/template/js
page.includeJSFooterlibs.bootstrap_navbar = fileadmin/user_upload/template/js/navbar.js
lib.contentElement.partialRootPaths.20 = fileadmin/user_upload/template/partials/ContentElements/
lib.contentElement.partialRootPaths.20 = fileadmin/user_upload/template/Partials/ContentElements/
lib.gridelements.defaultGridSetup {
// stdWrap functions being applied to each element
columns {
default {
renderObj = COA
renderObj {
# You can use registers to i.e. provide different image settings for each column
# 10 = LOAD_REGISTER
20 =< tt_content
# And you can reset the register later on
# 30 = RESTORE_REGISTER
}
}
}
# if you want to provide your own templating, just insert a cObject here
# this will prevent the collected content from being rendered directly
# i.e. cObject = TEMPLATE or cObject = FLUIDTEMPLATE will be available from the core
# the content will be available via fieldnames like
# tx_gridelements_view_columns (an array containing each column)
# or tx_gridelements_view_children (an array containing each child)
# tx_gridelements_view_column_123 (123 is the number of the column)
# or tx_gridelements_view_child_123 (123 is the UID of the child)
}
lib.tt_content.shortcut.pages = COA
lib.tt_content.shortcut.pages {
10 = USER
10 {
userFunc = tx_gridelements_view->user_getTreeList
}
20 = CONTENT
20 {
table = tt_content
select {
pidInList.data = register:pidInList
where = colPos >= 0
orderBy = colPos,sorting
orderBy.dataWrap = FIND_IN_SET(pid,'{register:pidInList}'),|
}
}
}
tt_content.shortcut.5 = LOAD_REGISTER
tt_content.shortcut.5 {
tt_content_shortcut_recursive.field = recursive
}
tt_content.shortcut.20 {
0 {
tables := addToList(pages)
conf.pages < lib.tt_content.shortcut.pages
}
1 {
tables := addToList(pages)
conf.pages < lib.tt_content.shortcut.pages
}
}
tt_content.gridelements_pi1 >
tt_content.gridelements_pi1 = COA
tt_content.gridelements_pi1 {
#10 =< lib.stdheader
20 = COA
20 {
10 = USER
10 {
userFunc = tx_gridelements_view->main
setup {
default < lib.gridelements.defaultGridSetup
}
}
}
}
The statics i included is:
Bootstrap Package: Full Pacakage (bootstrap_package)
Bootstrap Package: Bootstrap 4.x (SCSS) (bootstrap_package)
XML Sitemap (seo)
Gridelements w/DataProssing (recommended) (gridelements)
Gallery (bm_image_gallery)
EDIT2:
New TypoScript with DataProcessing
lib.gridelements.defaultGridSetup =< lib.contentElement
lib.gridelements.defaultGridSetup {
templateName.field = tx_gridelements_backend_layout
templateName.ifEmpty = GridElement
layoutRootPaths {
1 = EXT:gridelements/Resources/Private/Layouts/
}
partialRootPaths {
1 = EXT:gridelements/Resources/Private/Partials/
}
templateRootPaths {
1 = EXT:gridelements/Resources/Private/Templates/
}
dataProcessing {
10 = GridElementsTeam\Gridelements\DataProcessing\GridChildrenProcessor
10 {
default {
as = children
# Default options of the grid children processor
# Change them according to the needs of your layout
# Read more about it in the TypoScript section of the manual
# options {
# sortingDirection = ASC
# sortingField = sorting
# recursive = 0
# resolveFlexFormData = 1
# resolveBackendLayout = 1
# respectColumns = 1
# respectRows = 1
# }
}
}
}
}
My includes:
Fluid Contetn Elements (fluid_styled_content)
Fluid Contetn Elements CSS (fluid_styled_content)
Bootstrap Package: Full Pacakage (bootstrap_package)
Bootstrap Package: Bootstrap 4.x (SCSS) (bootstrap_package)
XML Sitemap (seo)
Gridelements w/DataProssing (recommended) (gridelements)
Gallery (bm_image_gallery)
The error I get:
Tried resolving a template file for controller action "Standard->3" in format ".html", but none of the paths contained the expected template file (Standard/3.html). The following paths were checked: /httpdocs/typo3conf/ext/bootstrap_package/Resources/Private/Templates/ContentElements/, /httpdocs/typo3conf/ext/gridelements/Resources/Private/Templates/
You probably missed to include the static template of gridelemnts. To do so edit your TS-Root-Template, select in the dropdown at the top "Info/Modify", hit the button "Edit the whole template record", go to tab "Includes" and select gridelements static setup in the Multiselect box on the right.
Please provide more information:
Which static templates have you included at all? Maybe you forgot to include fluid_styled_content?
How does your Typoscript/Flexform setup look like?
For what do you need gridelements?
EDIT: bootstrap_package did not very well together with gridelements in the past. Maybe you should first try to install Benjamin Knott's extension autogrids (see this issue on github for more information)
EDIT 2: Try this Typoscript, it just wraps a section around all elements but maybe you will then see your content in the frontend:
tt_content.gridelements_pi1.20.10.setup {
section < lib.gridelements.defaultGridSetup
section {
wrap >
dataWrap = <section id="c{field:uid}">|</section>
}
}
SOLVED:
I installed an extension that is called "Grids for bootstrap" included it in the template and it worked.
Thnaks for all the help you guys gave!
I think your problem is coming from your fluid code for gridelemnts, you didn't use the right syntax maybe.

InvalidTemplateResourceException after move to new server

i have a site package extension for my template in Typo3 9.5. Furthermore I have another extension for a specific purpose. Now this extension searches in the ProviderExtension for template files!?!? On my development machine everything works fine. After I have transferred everything to a remote server, this exception occurs on those pages where the plugin of the extension is included. Other pages work.
The Fluid template files enter code here
"/home/.sites/822/site4946398/web/bttemplate/public/typo3conf/ext/amtstafel/Resources/Private/Partials/Navigation/Top.html",
"/home/.sites/822/site4946398/web/bttemplate/public/typo3conf/ext/amtstafel/Resources/Private/Partials/Navigation/Top"
could not be loaded.
Here is the typoscript fom the Site-Template
page = PAGE
page {
config.index_enable = 1
typeNum = 0
shortcutIcon = EXT:btbuerger2/Resources/Public/Icons/favicon.ico
10 = FLUIDTEMPLATE
10 {
templateName = TEXT
templateName {
cObject = TEXT
cObject {
data = pagelayout
required = 1
case = uppercamelcase
split {
token = pagets__
cObjNum = 1
1.current = 1
}
}
ifEmpty = Default
}
templateRootPaths {
0 = EXT:btbuerger2/Resources/Private/Templates/Page/
1 = {$page.fluidtemplate.templateRootPath}
}
partialRootPaths {
0 = EXT:btbuerger2/Resources/Private/Partials/Page/
1 = {$page.fluidtemplate.partialRootPath}
}
layoutRootPaths {
0 = EXT:btbuerger2/Resources/Private/Layouts/Page/
1 = {$page.fluidtemplate.layoutRootPath}
}
...
The extension amtstafel has a static typoscript which is included in the Main-Template. Here templateRootPaths and layoutRootPaths is defined. As mentioned, the Extension was built with Extension-Builder and works fine so long..
plugin.tx_amtstafel_bulletinentry {
view {
templateRootPaths.0 = EXT:{extension.shortExtensionKey}/Resources/Private/Templates/
templateRootPaths.1 = {$plugin.tx_amtstafel_bulletinentry.view.templateRootPath}
layoutRootPaths.0 = EXT:tx_amtstafel/Resources/Private/Layouts/
layoutRootPaths.1 = {$plugin.tx_amtstafel_bulletinentry.view.layoutRootPath}
}
"bttemplate" is the template extension, "amtstafel" is the additional extension.
In the place of .../amtstafe/... there is not need for partials ...
Thank you for help!
Thomas
I suspect that your constant page.fluidtemplate.partialRootPath is set to EXT:amtstafel/Resources/Private/Partials/
This constant is used in your page.10.templateRootPaths.1

Typo3 Fluid Templates - How to set up different templates for different pages

I'm trying to build from scratch a website with typo3 9.5 and setting up different template files for different pages. How do I achieve this?
I'm following the tutorial from https://docs.typo3.org/m/typo3/tutorial-sitepackage/master/en-us/TypoScriptConfiguration/Index.html and also tried the solution with no success provided at Typo3 Fluid Templates How to add multiple templates
Now all pages load the Default template and if I set the default cObject to Alternative, it loads the Alternative.html to all pages, even when the TCA at Typo3 is set correctly for each page:
All Pages Back-end Layout to [Default]
Contact set to [Alternative].
_
page = PAGE
page {
typeNum = 0
// Part 1: Fluid template section
10 = FLUIDTEMPLATE
10 {
templateName = TEXT
templateName.stdWrap.cObject = CASE
templateName.stdWrap.cObject {
key.data = pagelayout
pagets__default = TEXT
pagets__default.value = Default
default = TEXT
default.value = Default
pagets__alternative = TEXT
pagets__alternative.value = Alternative
alternative = TEXT
alternative.value = Alternative
}
templateRootPaths {
0 = EXT:photo/Resources/Private/Templates/Page/
1 = {$page.fluidtemplate.templateRootPath}
}
partialRootPaths {
0 = EXT:photo/Resources/Private/Partials/Page/
1 = {$page.fluidtemplate.partialRootPath}
}
layoutRootPaths {
0 = EXT:photo/Resources/Private/Layouts/Page/
1 = {$page.fluidtemplate.layoutRootPath}
}
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
levels = 1
includeSpacer = 1
as = mainnavigation
}
}
}
I want to use for instance a default.html template for all pages except contact page, which will have it's own template ( site_template/Resources/Private/Templates/Page/Alternative.html ).
First:
you should use higher numbers for the paths to your templates.
The higher the number the higher the priority for overriding files with the same name.
second:
there is no field pagelayout. either use layout or better backend_layout and backend_layout_next_level (example configuration with the full usage of configuration for subpages).
Your key values (pagets__default and pagets__alternative) already hint to the usage of backend_layout (pagets__* is the usual key for backend layouts defined in page TSconfig).
Probably the example in the documentation needs some correction. (Pull-request commited)

best way to overwrite a extension template

what is the best way to overwrite the standard template of typo3 extensions so that they are save for updates?
thanks
Tried this:
plugin.tx_news {
view {
templateRootPath = fileadmin/webdesign/templates/news/Templates/
partialRootPath = fileadmin/webdesign/templates/news/Partials/
layoutRootPath = fileadmin/webdesign/templates/news/Layouts/
}
}
But nothing has changed
Here is an example from the tx_news doc:
The TypoScript Setup syntax looks like this:
plugin.tx_news {
view {
templateRootPaths {
0 = EXT:news/Resources/Private/Templates/
1 = EXT:fileadmin/templates/ext/news/Templates/
}
partialRootPaths {
0 = EXT:news/Resources/Private/Partials/
1 = fileadmin/templates/ext/news/Partials/
}
layoutRootPaths {
0 = EXT:news/Resources/Private/Layouts/
1 = fileadmin/templates/ext/news/Layouts/
}
}
}
Doc tx_news:
https://docs.typo3.org/typo3cms/extensions/news/3.0.0/Main/Templating/Start/Index.html
typo3 Doc:
https://docs.typo3.org/typo3cms/extensions/fluid_styled_content/7.6/Configuration/OverridingFluidTemplates/Index.html
Here another example from slickcarousel:
https://gist.github.com/misterboe/5de7498e810ebd57f7bfb4d2a7abeb66
Important to Know:
in TYPO3 CMS 6.2 and before you can just Overwrite the settings
templateRootPath = /path/to/you/template
in TYPO3 CMS 7.6 and later you can crate an Array where Fluid / TYPO3 is looking for the template. The Naming is different (now ends with an "s" ) and it must be an Array.
So OLD Examples for Version 6.x will not work in 7.6!
templateRootPaths {
0 = /path/to/originalExtension/template
1 = /path/to/you/template
}
same for partialRootPath -> now partialRootPaths and also layoutRootPath -> now layoutRootPaths
The advantage of this new Array: if you only want to overwrite ONE Partial or one Template: create the Directory in your own extension or Fileadin Folder and just put this one, changed File there
-> the filename should still be Identically
-> Look for CamelCase Errors (f.e. folder Name should be "Layouts" and not "layouts" .. this may work in windows Test System but not on production with linux ..
-> clear the TYPO3 cache .. as always ..

typoscript backend_layout_next_level not working

I have the following config
page = PAGE
page {
typeNum = 0
10 = FLUIDTEMPLATE
10 {
templateRootPath = EXT:folder/Resources/Private/Website/Templates/
partialRootPath = EXT:folder/Resources/Private/Website/Partials/
layoutRootPath = EXT:folder/Resources/Private/Website/Layout/
file.stdWrap.cObject = CASE
file.stdWrap.cObject {
key.data = levelfield:-1, backend_layout_next_level, slide
key.override.field = backend_layout
default = TEXT
default.value = whatever.html
1 < .default
2 = TEXT
2.value = whatever-else.html
}
}
Somehow the 'backend_layout_next_level' is not working; it is not sliding down the tree. As a result I have to set a backend_layout for each page which is not what one should expect.
Is there a way of knowing/debugging/finding out what's causing this? I thought it might be something related to a curly brace being in the wrong place (too early, too late or just plain wrong) inside my typoscript. Therefor I looked inside the Typoscript Template Analyzer and found some errors which I've fixed, but the problem still persists.
Thanks already!
Best regards
You use have to give the full path to the file as a value in the .file property or you should use .templateName instead and only provide the name (case sensitive!!!) of the template file without suffix.
#see https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Fluidtemplate/Index.html
Note that in your current setting, the uid of the template record must be 1 or 2.
And you can try to use levelfield: -2 instead of levelfield: -1.
TBH I never understood this #^$#% CASE syntax... Therefore definitely prefer common condition which works perfect, you must to add custom condition like I showed in other post, so you can use it like:
page {
typeNum = 0
10 = FLUIDTEMPLATE
10 {
templateRootPath = EXT:folder/Resources/Private/Website/Templates/
partialRootPath = EXT:folder/Resources/Private/Website/Partials/
layoutRootPath = EXT:folder/Resources/Private/Website/Layout/
file = whatever.html
}
}
[userFunc = user_beLayout(2)]
page.10.file = whatever-else.html
[userFunc = user_beLayout(3)]
page.10.file = yet-other.html
[userFunc = user_beLayout(4)]
page.10.file = etc.html
[end]
Edit - to satisfy some comments
Note: When I say that I don't understand CASE syntax, that doesn't mean that I don't know it... especially that I studied it in details not once, here's the conclusion...
About performance:
Custom conditions solution is faster than using CASE and slide combination as it doesn't involve additional DB queries (slide does), it iterates $GLOBALS['TSFE']->page array, which is already collected, and stops further checks ASAP, so it's cheaper than slide which makes additional queries if it finds slide in TS (doesn't matter if it's required or not) - (examine the code for slide mechanics), so actually conditions are performance-saver not killer :)
Yet more
Using conditions blocks you can change behavior of multiple elements at once (instead writing separate CASE for each) i.e.:
[userFunc = user_beLayout(2)]
page.10.file = whatever-else.html
lib.genericMenu >
config.absRefPrefix = /layout-specific-abs/
// etc...
[end]
Using CASE syntax you'll need to repeat all these checks for each element... (where's DRY?)
Finally
Both solutions are ... usable especially when using with cached pages, (difference between them will be about teens or maybe in drastic situation hundred milliseconds -conditions will be faster), for uncached pages most probably it will be good idea to set be_layout directly for each pages record in both cases.
It is quite some time ago, you probably resolved your issue but here is a working approach:
page = PAGE
page {
10 = FLUIDTEMPLATE
10 {
# select different html files for layouts - ref: backend_layout
file.stdWrap.cObject = TEXT
file.stdWrap.cObject {
data = levelfield:-2,backend_layout_next_level,slide
override.field = backend_layout
split {
token = pagets__
1.current = 1
1.wrap = |
}
wrap = EXT:folder/Resources/Private/Templates/|.html
}
layoutRootPath = EXT:folder/Resources/Private/Layouts/
partialRootPath = EXT:folder/Resources/Private/Partials/
}
}
or you can pass it as a variable:
page = PAGE
page {
10 = FLUIDTEMPLATE
10 {
file = EXT:folder/Resources/Private/Templates/Main.html
layoutRootPath = EXT:folder/Resources/Private/Layouts/
partialRootPath = EXT:folder/Resources/Private/Partials/
variables {
# BE_Layout
BE_Layout = COA
BE_Layout {
stdWrap.cObject = TEXT
stdWrap.cObject {
data = levelfield:-2,backend_layout_next_level,slide
override.field = backend_layout
split {
token = pagets__
1.current = 1
1.wrap = |
}
wrap = |.html
}
}
}
}