TYPO3 6.1 Extbase – how to call controller action via Typoscript directly

If you have an extbase extension and you need to call a controller action via TypoScript, things have changed from TYPO3 4.7 to 6.1. TYPO3 6 has a lot of code rewritten, depends heavily on PHP namespaces and extbase extensions from earlier versions will no longer work.
To get started with all the necessary bootstrap code for a new extension, use the extension “extension_builder” from TER.

Let’s assume we have a little extension and we want to assign the result of a direct call of a controller action to a TS object.
Our controller code looks like this:

namespace MyVendorName\MyExtName\Controller;
class MyModelController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {

public function myTestAction() {
return "some string";


Please notice the namespace, this is very important! Your ext_localconf.php should look something like this:

	'MyVendorName.' . $_EXTKEY,
		'MyModel' => 'myTest',	
	// non-cacheable actions


‘Pi1’ is simply the name of the frontend plugin

TypoScript config

Now we set up a TS-object which should hold the output of our “myTestAction” method.

lib.myObj = USER
lib.myObj = 10
   10 { 
        userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
        pluginName = Pi1
        extensionName = MyExtName
        controller = MyModel
        vendorName = MyVendorName
        action = myTest
        switchableControllerActions {
          MyModel { 
            1 = myTest
        settings =< plugin.tx_myextname.settings
        persistence =< plugin.tx_myextname.persistence
        view =< plugin.tx_myextname.view
        update =< plugin.tx_myextname.update

The parameter "vendorName" is new and very important - it won't work without it. Take care of the camel case notation too - the whole extbase framework is based on this case-sensitive coding convention.

Now we are done - our controller action is directly called via TypoScript.


2 thoughts on “TYPO3 6.1 Extbase – how to call controller action via Typoscript directly

  1. Jennifer Koenig

    Die Artikel war sehr hilfreich. Ich habe aber noch eine Frage: wie würde die Ausgabe des Typoscript Variables in Fluid aussehen?



    Was ist die Unterschied?
    Was tun wenn der Beispiel nicht funktioniert?

  2. Elmar Post author

    Hallo Jennifer,
    Dieser Code lädt ja den Controller inkl. den entsprechenden Views und kann bspw. in einem PAGE Objekt direkt verwendet werden. Ich verwende das bspw., wenn ich Widgtets auf Seiten integriere,

    page = PAGE
    page.10.variables.myWidget < lib.myObj

Leave a Reply

Your email address will not be published. Required fields are marked *