TYPO3 4.6 include extbase plugin with typoscript - plugins

I have TYPO3 4.6, in tempvoila template i have typoscript object path lib.header and I want
to redirect output of plugin to lib.header
I have extension Gallery and plugin written and configured in ext_localconf.php like this:
Tx_Extbase_Utility_Extension::configurePlugin(
$_EXTKEY,
'RandomPhotoSlideShow',
array(
'Photo' => 'randomPhotoSlideShow',
),
// non-cacheable actions
array(
'Photo' => ''
)
);
in ext_tables.php like this:
Tx_Extbase_Utility_Extension::registerPlugin(
$_EXTKEY,
'RandomPhotoSlideShow',
'Gets random photos for slide show'
);
and in typoscript template I have this:
plugin.tx_gallery.widgets {
papaWidget = USER
papaWidget {
userFunc = tx_extbase_core_bootstrap->run
pluginName = RandomPhotoSlideShow
extensionName = Gallery
controller = Photo
action = randomPhotoSlideShow
switchableControllerActions {
Photo {
1 = randomPhotoSlideShow
}
}
settings =< plugin.tx_gallery.settings
persistence =< plugin.tx_gallery.persistence
view =< plugin.tx_gallery.view
}
}
lib.header < plugin.tx_gallery.widgets.papaWidget
But nothing is displayed, could someone please advice where I have mistake or if something changed in extbase 1.4 included in TYPO3 4.6?

I think the problem is your action. Do you really have a randomPhotoSlideShowAction in your Controller?
Also check if the specified pluginName is correct.
Please try to specify your index or list Action and see what happens.
action = index
switchableControllerActions {
Photo {
1 = index
}
}
If your action is correct, make sure you are actually returning something from your action!
public function randomPhotoSlideShowAction(...) {
// [...]
$this->view->assign('foo', 'bar');
return $this->view->render();
}

Your code looks good, the only thing missing is the Controller part (as per naming convention) in
controller = PhotoController

Related

TYPO3 render Event from typoscript and Fluid template

In TYPO3 10.4.8 I have the following page tree:
root
1level: Events
2level: Event A, Event B, Event C, ... and so ...
What I want to do in page Events is to render all subpages title, using FLUIDTEMPLATE.
So in the template of page Events I wrote
lib.EventContent = COA
lib.EventContent {
10 = COA
10{
table = pages
select {
orderBy = sorting
pidInList = this
}
}
}
and in the layout file
<f:for each="lib.EventContent" as="event" >
<p>event: {event.title}</p>
</f:for>
This doesn't work. Typo give me this error:
The argument "each" was registered with type "array", but is of type "string" in view helper "TYPO3Fluid\Fluid\ViewHelpers\ForViewHelper".
In addition, I also tried to change COA with CONTENT, in all possible combination (COA-CONTENT / CONTENT-COA / CONTENT-CONTENT)
What's wrong? is something that I cannot do?
Thanks all
The TypoScript should look something like this:
lib.EventContent = CONTENT
lib.EventContent {
table = pages
select {
orderBy = sorting
pidInList = this
}
}
But there is a much easier solution. TYPO3 already brings a content element "Subpages" which renders a menu of all subpages of a selected page:
This is done via Fluid Styled Content and TypoScript. Please check this file for details:
typo3/sysext/fluid_styled_content/Configuration/TypoScript/ContentElement/MenuSubpages.typoscript
A solution for you might look like this (untested):
lib.EventContent < tt_content.menu_subpages
lib.EventContent {
dataProcessing {
10 {
special >
}
}
}
It's also a good idea to have a look in all the TypoScript files in the Fluid Styled Content extension to get more inspiration.

TYPO3 Extbase Parameters in Url get ignored. No action is called

I'm writing an extension which checks for the browser version, and if the version isn't supported a hint is showed.
I'm doing this with a typoscript condition, which works well so far. But in the hint is a link for the ignoring. The link should call my action "setSessionParameters" in the controller "BrowserCheck". If the link is clicked the correct url gets called, but the same output as before is shown (the hint). The action is completly ignored. I tried to put in a non existing action, but not even an exception is called, which means for me: It's not checked if the question is allowed in the ext_localconf and neither it gets checked in the controller.
I think the typoscript configuration could be a problem, but I can't find a solution. Can anyone help?
Please see my code below
ext_localconf.php:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'VENDOR.' . $extensionKey,
'browsercheck',
[
'BrowserCheck' => 'setSessionParameter',
],
[
'BrowserCheck' => 'setSessionParameter',
]
);
page.typoscript:
page = PAGE
[session('wcobrowsercheck') == "ignore" || checkInternetExplorer()]
page{
//normal setup
}
[ELSE]
// called setup for hint-case
page >
page = PAGE
page{
typeNum = 0
shortcutIcon = {$files.favicon.path}
10 = FLUIDTEMPLATE
10 {
templateRootPaths {
0 = EXT:my_extension/Resources/Private/Templates/BrowserCheck
}
layoutRootPaths {
0 = EXT:my_extension/Resources/Private/Layouts/BrowserCheck
}
templateName = MainPage
}
includeCSS {
...
}
}
[END]
link call in the template:
<f:link.action controller="BrowserCheck" action="setSessionParameters" extensionName="my_extension" pluginName="browsercheck" arguments="{ignore: 'true'}"> ignore </f:link.action>
I see 2 issues with your setup.
You define the PAGE object twice. And the second time you wipe all previous configuration
I can't see that you have placed the plugin on the page.
As your question targets the second issue, I recommend adding the plugin to the page via typoscript if you want that plugin to be available everywhere.
page = PAGE
// ...
page.999 < tt_content.list.20.extkey_pluginname
Or you use a plugin that is placed on the page as a content element. Both will work. But with the current setup you cannot call the plugin as it's not present on the page.

TYPO3 insert plugin on every pages

I have TYPO3 version 7.6.18. I want to insert some plugin in every pages, I think it may be do with typoscript? Help me please, how to do it ?
If you want to insert a specific plugin on every page, you can simply add it to your page like so:
page = PAGE
page{
10 = FLUIDTEMPLATE
10{
# the fluid template settings
}
# add a fixed plugin to be rendered after the normal fluid template
20 = USER
20{
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = MyExt
vendorName = MyVendor
pluginName = Pi1
switchableControllerActions{
TheController{
0 = actionName
}
}
}
}
This basically adds a new section to your page rendering that only renders your plugin.
You could also load the plugin into lib and render it in your FLUID template.
TypoScript
lib.myPlugin = USER
lib.myPlugin {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = MyExt
vendorName = MyVendor
pluginName = Pi1
switchableControllerActions{
TheController{
0 = actionName
}
}
}
FLUID template
<f:cObject typoscriptObjectPath="lib.myPlugin"/>

How can I access to Flexform Settings when I embed my plugin over TypoScript

I embed a TYPO3 plugin via typoscript and everything is ok. I can access to the TypoScript Settings but not to Flexform Settings. here is my code:
temp.mCOA = USER
temp.mCOA {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = ExtensionName
pluginName = Pi1
vendorName = Vendor
controller = MyController
action = list
switchableControllerActions {
MyController {
1 = list
}
}
view < plugin.tx_extensionname_pi1.view
persistence < plugin.tx_extensionname_pi1.persistence
settings < plugin.tx_extensionname_pi1.settings
}
Can Someone help me Please?
thank you in advance for your help.
If you set your extension within typoscript there is no FlexForm. The FlexForm belongs to an Content Element.
Settings to the typoscript embeded version must be put into the plugin.tx_extensionname_pi1.settings scope per TypoScript.
With Flexform you can provide the abilty to your users to override typoscript settings when they put an new content element with your plugin onto an page.

Get page header and footer preview in backend

I have created a TYPO3 plugin to add new content columns to tt_content.
I need the header and footer content for my preview page in the backend. Once i get the header and footer I can show my contents in between this.
I want to insert some edit features in the content area. that is why I need the html rendered output to a php variable.
I am using templavoila.
I tried this - but got an error:
$this->cObj = t3lib_div::makeInstance('tslib_cObj');
$conf = array('userFunc' => 'tx_templavoila_pi1->main_page');
$content = $this->cObj->USER($conf);
#1316104317: The default controller for extension "myplugin" and plugin "ContentRenderer" can not be determined. Please check for TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin() in your ext_localconf.php.
You can use this TypoScript :
10 = USER
10 {
userFunc = tx_extbase_core_bootstrap->run
pluginName = Pi1
extensionName = EXTNAME
controller = CONTROLLERNAME
action = ACTION
}
Just replace EXTNAME, CONTROLLERNAME, ACTION.