-->

TYPO3 4.6 include extbase plugin with typoscript

2019-06-03 09:28发布

问题:

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?

回答1:

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();
}


回答2:

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

controller = PhotoController