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
Related
I have a typo3 installation with one extension that has a plugin.
I want to add the plugin to one page via typoscript and all subpages in that page tree should have it as well.
I only find code fragments that use switchableControllerActions but this is deprecated, as far as I can see.
How can I tell the plugin in the page which action is the action to use?
These fragments handling switchableControllerActions can be ignored if you have already separated plugins in your extension.
lib.insertPlugin = USER
lib.insertPlugin {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
vendorName = myVendor
pluginName = MyPlugin
extensionName = MyExtension
settings =< plugin.tx_myExtension.settings
persistence =< plugin.tx_myExtension.persistence
view =< plugin.tx_myExtension.view
settings {
// ...
}
}
The plugin will use its default action (except, there is another action defined in the request, e.g. by submitting a form, following a link,...).
The first action in the action list of the first line of the configuration parameter is the default action of the plugin. (-> \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin())
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.
I use this TYPO3 news extension.
I want to disable paging though typoscript. The option for it is plugin.tx_news.settings.hidePagination so I tried this
plugin.tx_news {
settings.hidePagination = 1
}
But this doesn't work. However setting plugin.tx_news.settings.list.paginate.itemsPerPage to a very large value does work. But that isn't a very nice solution.
Have I missed something on how to set hidePagination?
Theres a checkbox in the tx_news plugin.
Additional -> Hide the pagination
It seems to overwrite the TS (unchecked by default).
Does
plugin.tx_news {
settings.hidePagination = 1
}
get called in your template?
You can always check this with
<f:debug><{settings}</f:debug> to see what get's parsed.
The option to hide the pagination only hides the pagination in the frontend and does not show all news entries at one page. You can only set a high number to the list View to show all entries at one page. I think, there is no other solution at this time.
To override the values set in the news plugin flexform, you have to add the field to plugin.txnews.settings.overrideFlexformSettingsIfEmpty.
To add the field in question to the news extension standard list add this to your TS:
plugin.txnews.settings.overrideFlexformSettingsIfEmpty := addToList(hidePagination)
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.
In TYPO3 6.1, how do I get the tsconfig for the tx_news news extension to work?
I try to add selectable layouts to news items:
tx_news.templateLayouts {
1 = A custom layout
99 = LLL:fileadmin/somelocallang/locallang.xml:someTranslation
}
This should add the new Layout to the Type field, as in:
or did I get that wrong? Where can that new custom layout be selected?
Also, I'm trying to prefill fields in flexforms (when a new plugin is inserted):
TCEFORM.tt_content.pi_flexform.tx_news.sDEF.categoryConjunction = and
But it does not work yet.
How can this be done?
With tx_news.templateLayouts you override the flexform for the news plugin you insert on a page, not for a news record.
Your second code looks almost right, but you forgot settings: TCEFORM.tt_content.pi_flexform.tx_news.sDEF.settings.categoryConjunction = and
And even though this code is right, it will not work because of a bug with flexform fields that have a dot in their name (this is just stupid).
I think the only way to cleanly modify the flexform, is to write a small extension which overrides the default news flexform.