How to set the body background for typo3 without or with extension? - typo3

I am using typo3 v9.5.0. I need to design a website with a background image wrapped all over the content element and menu. There is no specified layout in bootstrap package. I've tried extensions like background by uploading the image.
But there is something wrong. By default its pointing the wrong resource which it left(typo3/01_DBM).
I have no clue why it's behaving like that. If there is any other extension or technique, kindly suggest me. But I want it to be done dynamically because it needs regular updation.

TYPO3 9.5.0 is outdated. although you use it localy update to current version.
you have multiple options to integrate a background image to the whole page.
Here my recommandation which does not require any specific extension:
As you use the bootstrap-package you can enhance the Fluid-templates of it in your own site-extension (which you should use).
Where do you get the image from?
Every pages record (defining a page in TYPO3) has fields for related media files (you can find/set it on the Resources tab.
Here an editor can easily insert an image which should be used as a background image to the content.
In your typoscript definition of variables for the page you can define an own variabel for the first image
10 = FLUIDTEMPLATE
10 {
[...]
dataProcessing {
111 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
111 {
references {
fieldName = media
table = pages
}
as = BackgroundImages
}
}
[...]
}
and use it in the fluid template for the page like:
[...]
<div style="background-image:url(fileadmin/{BackgroundImages.0.originalFile.identifier});">
<f:cObject typoscriptObjectPath="lib.dynamicContent" data="{pageUid: '{data.uid}', colPos: '0'}" />
</div>
[...]
further enhancements could use a sliding mechanism, so a page without own background-image could use the image of parent page.

Related

Getting the page title from the new PageTitle

I'm looking for a way to get the page title set via the new PageTitleProvider API to display it inside a FluidTemplate.
In one of our TYPO3 installations, the page title is used as title, displayed on the page itself. The main PAGE object is set up to render a FLUIDTEMPLATE object. I've implemented the examples on the new PageTitleAPI in the documentation, https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/PageTitleApi/Index.html into my extensions and that works just fine for the tag.
However, within the page itself, the title set in the page is still displayed, not the title I've set in my extension.
I've figured out, that I can instantiate the PageTitleProviderManager, but getTitle still resolves to the page name, not the title I've set, most likely because this object is resolved before the PageTitleProviders are set up by the extensions.
$pageTitleProviderManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\PageTitle\PageTitleProviderManager::class);
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( $pageTitleProviderManager->getTitle() );
// -> outputs the page name, not the title custom page title
Is there a way to resolve the page title after all Providers are processed and display it in a fluid template?
I also assume it depends on order of execution. so you need to build an order where your plugin is executed before the page title is rendered in the page template.
nowadays most integrators use the f:cObject viewhelper to render the content with lib.content. that means the content (and your plugin is rendered very late), as the page title is probably rendered before any content in the page template (independend whether you use template variables from the page template or a viewhelper which executes PHP or typoscript in the moment of the rendering.
Here you get a hint how to change the order:
try to render the content (including plugins) into a fluid-variable with the page templating ( e.g.:
page.10 = FLUIDTEMPLATE
page.10.variables.content < styles.content.get
) and try to get the page title when the page fluid is rendered: use a viewhelper to get the page title when the initial FLUID variables are already computed.
of course you also can define a FLUID-variable for the content in the page FLUID template before accessing the page title by viewhelper:
<f:variable name="content"><f:cObject typoscriptObejctPath="lib.content" /></f:variable>

TYPO3: How to properly setup RTE in custom content element

I created a custom content element with a "bodytext" field like this:
bodytext;Text;;richtext:rte_transform[flag=rte_enabled|mode=ts_css],
rte_enabled;LLL:EXT:cms/locallang_ttc.xlf:rte_enabled_formlabel
The text editor doesn't work properly. The links for example are formated like this:
<link 88 - internal-link>test</link>
which doesn't work in the frontend.
RTE is also throwing a lot of info and errors in the backend, here is a screenshot of firebug:
If I use a core content element like "text & media" RTE does work perfectly .. So I guess there is some configuration missing in my extension ?
How did you set up your custom content element? In which file did you set up your bodytext field shown above?
The link formatting like <link></link> is the normal and correct behavior of the RTE. By this way, links can be rendered dynamically having the pageid saved and they will still work even if the domain or pagetitle of the target page changes - this would not work if links would be saved "hard" like <a href="xy">.
However, those link tags have to be rendered using the lib.parseFunc_RTE when outputting the content. For example if you use Fluid for output, just use <f:format.html>{yourBodytextVariable}</f:format.html> and you will get correct links (f:format.html uses lib.parseFunc_RTE by default).
Check out your Typoscript Object Browser to find out more about the lib.parseFunc_RTE object and check out this doc: https://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Parsefunc/Index.html

Do you need to add some Typoscript when using flux:grid together with v:content.render?

I am attempting to use Fluid templates to render pages. I have created an extension file provider and some page templates which appear to be rendering.
Unfortunately, the content I add to pages is not rendering.
I am attempting to follow the example in the Flux documentation (Two-column page template and Page Rendering sections).
I have also been reading the Creating Page Template page in the Fluid documentation.
When I do this, it correctly makes the grid layouts available in the TYPO3 backend.
However, when I select one of those layouts for a page, and then add some content, the content is not rendered in the page.
Am I missing a step? For example, is there some Typoscript I need to write here? The documentation appear to be incomplete/unfinished.
I have tried adding the following Typoscript in Configuration/Typoscript/setup.txt:
page {
10 {
variables {
left < styles.content.get
left.select.where = colPos = 0
right < styles.content.get
right.select.where = colPos = 1
}
}
}
But it had no effect.
Did you include the static templates of either css styled content or fluid styled content?

TYPO3 How to create a custom "infobox"?

I am trying to make an "Infobox" with TYPO3.
In my HTML Template i have the Infobox:
<div id="infobox">
<!-- ###infobox### start -->
CONTENT from the backend
<!-- ###infobox### start -->
</div>
...
Now in my Backend, i have a content element, that keeps the content for my Infobox in the Frontend:
What i want to do is: If i disable the content element via the "disable button" in the backend, i want to change the CSS of my #infobox (adding display:none) or if I re-enable it I want to remove the display:none.
I hope I could explain my issue and hope someone can help me.
As far as I understand, you want the disabled flag of the content element to only influence the rendered output, not switch off the rendering.
I fear that this is not easily possible. The disabled column is part of TYPO3’s so-called enable fields, for which checks are added all over the place by the TYPO3 API. Due to this, "hidden" records are usually not even selected from the database, so they are also never fed to the rendering engine.
An alternative would be to use a custom content type with a custom field for your purpose, hide the "hidden" field in the form for that type and put the custom field in its place. This can all be done with standard TYPO3 core mechanisms.
What you cannot avoid however is that somebody will be able to hide/disable the content element from the page or list module. This cannot be prevented as your content needs to live in the same table (tt_content) as the rest of the content—and the settings for enable fields are global per table.
You can use an custom fluid content element
see: http://www.creativeworkspace.de/blog/artikel/eigene-inhaltselemente-im-typo3-cms-62x-und-7x/
or: https://docs.typo3.org/typo3cms/extensions/fluid_styled_content/7.6/AddingYourOwnContentElements/Index.html
or you use a custom layout
TCEFORM.tt_content {
layout {
addItems {
item1 = Name of Layout
}
}
}
after this you can get it with {data.layout} in your template
{f:if(contition:'{data.layout} == item1',then:'display:none')}

How to stop TYPO3 from stripping <p> tags from RTE content (or touching it at all)

I have a TYPO3 which strips any <p> tags from content I create when the RTE editor is enabled for the field in question before it saves it in the DB. And it seems I cannot find a way to disable this behavior with a TypoScript. As soon as I disable the RTE editor I can save <p> tags and they get correctly rendered in the frontend. They also get correctly rendered in the frontend when I simply add them directly in the database in the tt_content table in the bodytext field.
When I switch to the edit source mode of the RTE I see all <p> tags in place. Before and after a save (also they never make it to the DB) so it looks like they get converted to (linux) line breaks or something and get converted back to <p> tags when the editor loads them in the backend. But those line breaks of course have no effect to in the frontend.
I thought this behavior would be controlled by RTE.default.proc but everything there looks good to me (p is already in the allowed tags and there is no clue why it could be stripped). I've also tried to disable the RTE.default.proc.entryHTMLparser_db and RTE.default.proc.exitHTMLparser_db as I wouldn't mind it if the HTML content as you see it in the edit source mode of the RTE (so with RTE still enabled!) would not be touched at all - in fact I would prefer it - but this had no effect. On the other hand when I add tags to the allowed tags which weren't there before (like <button>) this works so the things I try to add to RTE.default.proc aren't ignored in general.
So how can I stop TYPO3 from stripping my <p> tags from RTE content or touching it at all? I'd prefer a solution with TypoScript but meanwhile I would also be happy about an ugly hack in a sys extension as long as it works...
I'm not sure if this is a bug or not but the solution to my problem lies in p.rmTagIfNoAttrib = 1. At least in my TYPO3 version (v6.1.7 and nearly only built in extensions) I cannot find this setting in the preset TypoScript of the page or the RTE editor so I'm guessing it defaults to 0. In my logic 0 means false so I'd say the default would read as "remove tag if there is no attribute?: no!".
However TYPO3 seems to work after its own logic. Adding the following statement to the page TS sloves my problem and <p> tags are preserved:
RTE.default.proc {
entryHTMLparser_db {
tags {
p.rmTagIfNoAttrib = 1
}
}
}
The reasons for this behavior are explained in the TYPO3 manual:
Many of the transformations performed back and forth in the TYPO3 backend date back to when it was a challenge to incorporate a RTE in a browser. It was then sometimes needed to fall back an a simple <textarea> where rich text had to be presented in a simple enough way so that editors could work with it with no visual help.