1

This is more like a basic question:

How do I get an extension (by Extension Builder) to run a simple PHP code without adding a domain model and actions?

Norman
  • 785
  • 7
  • 27
  • @ViktorLivakivskyi This version looks promising, but I still don't know how to include the output into my template. When adding a default html template to my extension it asks for a default controller, which doesn't and shouldn't exist. – Norman Aug 17 '16 at 08:33
  • 1
    Well, you can try to use `StandaloneView`, just instantiate it, `->setTemplateRootPaths(...)`, and then return result of `->render()`, but it would be more convinient, if you create normal Extbase Controller and get lot of magic out of the box. – Viktor Livakivskyi Aug 17 '16 at 08:39

1 Answers1

5

In general, there are 3 options:

I would still go with option number 3 and therefore you still will need an action. Having actions is good because of you add a 2nd variant, you can just use a 2nd action and there is not much additional code you need.

Having such an extension is fairly easy. One example I did lately was this extension: https://github.com/sup7even/mailchimp

In general you need:

ext_localconf.php

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'Sup7even.' . $_EXTKEY,
    'Registration',
    array(
        'Form' => 'index,response,ajaxResponse'
    ),
    array(
        'Form' => 'index,response,ajaxResponse'
    )
);

ext_tables.php

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'Sup7.' . $_EXTKEY,
    'Registration',
    'Mailchimp'
);

And the RegistrationController. By default, the first action will be called which is in this case index, therefore you need an indexAction and the Template must be Templates/Registration/Index.html.

Community
  • 1
  • 1
Georg Ringer
  • 7,779
  • 1
  • 16
  • 34