TYPO3流体xml渲染

时间:2017-05-16 17:32:52

标签: php typo3 typoscript typo3-6.2.x

我想将TYPO3 fe插件渲染为有效的xml

我如何更改:(我的布局)

<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>

带有fe插件的页面的typoscript看起来像这样:

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

但我有一个白页

我的失败是什么?

更新 新的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',
    )
);

1 个答案:

答案 0 :(得分:2)

首先,您应该使用如下配置将整个页面(-object)更改为xml内容:

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"
      }
    }
  }
}

以上配置已经将您的扩展/插件添加到此页面,而无需在后端页面模块中添加它,因此您不需要&lt; styles.content.get

然后你应该将你的整个Templatefile更改为.xml - 使其工作你需要更改你的initializeWhateverAction中的格式(在控制器内):

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

您可能需要清除Installtool中的所有缓存。