Search code examples
phptypo3typoscripttypo3-6.2.x

TYPO3 fluid xml rendering


I want to render a TYPO3 fe plugin as a valid xml

How do I have to change this: (my layout)

<div xmlns="http://www.w3.org/1999/xhtml" lang="en"
         xmlns:f="http://xsd.helhum.io/ns/typo3/cms-fluid/6.2/ViewHelpers">

    <f:layout name="Rss"/>
    <f:section name="main">

        <f:for each="{events}" as="event" iteration="iteratorEvents">

        <item>
            <topic>{event.topic}</topic>
            <startTime>StartDatum: <f:format.date format="{dateFormat}">{event.startDateTime}</f:format.date></startTime>
            <endTime><f:format.date format="{dateFormat}">{event.endDateTime}</f:format.date></endTime>
        </item>

        </f:for>
    </f:section>

</div>

The typoscript of the page with the fe plugin looks like this:

page = PAGE
page.20 = TEMPLATE
page.20.template = FILE
page.20.template.file = fileadmin/config/script/template/templateBlank.html
page.20.marks {
  CONTENTMAIN < styles.content.get
  #CONTENTMAIN < tt_content
}

page.config.disableAllHeaderCode = 1
#page.config.xhtml_cleaning = none
#page.config.admPanel = 0
#page.config.metaCharset = utf-8
#page.config.additionalHeaders = Content-Type:text/xml;charset=utf-8

But I got a white page

whats my fail?

Update New Typoscript

    page = PAGE
    page {
      typeNum = 0
      config {
        disableAllHeaderCode = 1
        xhtml_cleaning = none
        admPanel = 0
        debug = 0
        metaCharset = utf-8
        additionalHeaders = Content-Type:text/xml;charset=utf-8
        disablePrefixComment = 1
      }
      10 = USER
      10 {
        userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
        extensionName = institutsseminarverwaltung
        pluginName = ShowseminarsRSS
        vendorName = VENDOR
        switchableControllerActions {
          Event { // Controllername without "Controller"
            1 = rss
          }
        }
      }
    }


Update Localconf

<?php
if (!defined('TYPO3_MODE')) {
    die('Access denied.');
}

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'TYPO3.' . $_EXTKEY,
    'Showseminars',
    array(
        'Event' => 'list, download',

    ),

    // non-cacheable actions
    array(
        'Event' => 'list, download',
    )
);



\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'TYPO3.' . $_EXTKEY,
    'ShowseminarsRSS',
    array(
        'Event' => 'rss',

    ),

    // non-cacheable actions
    array(
        'Event' => 'rss',
    )
);

Solution

  • First of all you should really change the whole page (-object) to xml content using a config like this:

    page = PAGE
    page {
      typeNum = 0
      config {
        disableAllHeaderCode = 1
        xhtml_cleaning = none
        admPanel = 0
        debug = 0
        metaCharset = utf-8
        additionalHeaders = Content-Type:text/xml;charset=utf-8
        disablePrefixComment = 1
      }
      10 = USER
      10 {
        userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
        extensionName = YourExtensionname
        pluginName = PluginName // like "Pi1"
        vendorName = VENDOR // Change to your VendorName
        switchableControllerActions {
          Event { // Controllername without "Controller"
            1 = list // Actionname without "Action"
          }
        }
      }
    }
    

    The above configuration will already add your extension / plugin to this page without any need of adding it in the backend page-module so you don't need < styles.content.get

    Then you should change your whole Templatefile to .xml - to make it work you need to change the format in your initializeWhateverAction like this (inside the controller):

    public function initializeListAction()
        {
            $this->request->setFormat('xml');
        }
    

    You may need to clear all caches in Installtool.