How can I avoid displaying the web-view-link IN the web view of TYPO3-ext newsletter? - typo3

I'm using TYPO3 newsletter extension and I'm looking for a solution not to display the link to the web view again when the web view already is shown.
newsletter is an extension that makes it possible to send pages as an email. If the users clicks on the link in the email, a browser window opens with a web view of the newsletter. I want to avoid the redundant display of this link.
In my newsletter fluid template i've got the following line:
###:IF: newsletter_view_url ###<p>If this e-mail cannot be display correctly, please click here.###:ENDIF:###</p>
The placeholders are delivered exclusively by the extension, so they are - as you see - no typoscript vars. The problem is: newsletter_view_url is always filled with a value and also the other possible vars always take the same value in email view as well as in web view.
What i tried so far:
Assign some var to the fluid template to distinct the web view from the email view:
# Create a Fluid Template
page.10 = FLUIDTEMPLATE
page.10 {
# Set the Template Paths
partialRootPath = {$privateTemplatePath}Partials/
layoutRootPath = {$privateTemplatePath}Layouts/
variables {
controllerAction = TEXT
controllerAction.data = GP:tx_newsletter_p|action
}
}
and in the fluid template file:
<f:if condition="{controllerAction}"><p>If this e-mail cannot be display correctly, please click here.</p></f:if>
Problem: controller action does not take any value though it is set in the get-string while opening the url from the newsletter:
test.html?type=1342671779&tx_newsletter_p%5Bc%5D=a0648d94a22dd5928762b1bd5f82e9de&tx_newsletter_p%5Baction%5D=show& ...
It also does not work if i use controller action for a typoscript condition
controllerAction = TEXT
controllerAction.value = 1
[globalVar = GP:tx_newsletter_p|action = show]
controllerAction.value = 0
[global]
I would be very grateful for further inspirations! Thank you so much!

According to this feature request, it is not implemented yet:
https://github.com/Ecodev/newsletter/issues/19
I suggest contacting author and submitting pull request with this change. As of how to implement it, might be changing the PHP code to add custom parameter to the URL when viewing in browser which would hide any part of newsletter template.

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>

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

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.

How to call a controller action on every page request

I have a Plugin with various actions, one of the Actions I would like to call every time a page is requested. I tried it this way but when I have the plugin on the same page (lets say it's a Contact form) Then the Plugin didn't know the other Actions, so I have to include every time all actions in the switchableControllerActions.
Is there maybe an another way? Maybe register the Action of the Controller in some kind of hook?
Probably you can create lib object of the extension, Take a look at below user function:
lib.myData = USER
lib.myData {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = Ext
pluginName = pluginName
vendorName = MyVendor
switchableControllerActions {
MyController{
1 = myAct
}
}
settings < plugin.tx_ext.settings
settings {
// Your settings
}
}
Now, you can call the lib object to the fluid template (As you need for each page) you can add this object to the main page layout.
Here Georg Ringer has created same code to render news listing with Typoscript.
Hope this will help you!
OK I've recieved a hint and that's the Solution:
20 = USER_INT
20 {
userFunc = Vendor\Extension\UserFunc\Class->function
}
You can use FlexForms to set a preset Controller->Action. So even if you use a plugin twice on one page you can control the Controller->Action of each Plugin via FlexForm.
Maybe this helps a well:
Multiple controllers in an extension

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')}

TYPO3 tags and image issue with EXT: News System KEY: news VER: 2.2.1

Hi All
I'm running:
EXT.KEY: news on TYPO3 v. 6.1 with FLUID/EXTBASE.
I have 2 issue's/question.
1 - News Tag's disappear, when using "tag list" in plugin.
I have added a "tag list" as element on my TYPO3 page, and its working fine, my problem is when i add another news plugin on another page, it's showing all the tag's from the two news plugin setup and I dont what to do that, so if i go to "Startingpoint" in Settings/plugin for the "Tag List" news-element and set it to the folder I save my newslist1 in, then all the tag's are disappeared, how can I set the "Tag list" so it's only show the tag's thats in the news from the folder "Newslist1"?
I have done this "startingpoint" with the list show and its working fine, if at news page 1 it show the news from folder "newslist1" and if on news page 2 it shows only the news/items from folder "portfolio".
2 - more images for a news.
Is it possible to add some image for the news text, so i have 2-3 images in the site, like when u add a normal text/image element?
Answer to issue 2
You can enable the use of normal content elements in News. The switch to activate that feature is in the Extension Manager configuration of News. You then have the possibility to add any content element to a News record.
By default the content elements are rendered before the normal news content, see here:
https://git.typo3.org/TYPO3v4/Extensions/news.git/blob/HEAD:/Resources/Private/Templates/News/Detail.html#l67
Of course you can change to order if you copy the template and adjust it to your needs.
Its beter add you plugin width ts, like
lib.newstags = USER
lib.newstags{
userFunc = tx_extbase_core_bootstrap->run
extensionName = News
pluginName = Pi1
switchableControllerActions {
Tag {
1 = list
}
}
settings < plugin.tx_news.settings
settings {
listPid = 73 # here you tagse source page/folder
}
}
Its beter to use Type "Innernal link". You can select in item edit form. Than you can add any page like contents element in your news item.