With TYPO3 v4.5 the TypoScript Content Object FLUIDTEMPLATE is available.
It works similar to the regular TEMPLATE cObject but instead of the marker and subpart based templates it expects a Fluid style templates.

Note: Currently the extensions Fluid and Extbase have to be installed for this Content Object to work.

Usage

Using this Content Object is as simple as:

10 = FLUIDTEMPLATE
10.file = fileadmin/templates/MyTemplate.html

 

With the variables key you are able to set values that will be available within your Fluid template:

10 = FLUIDTEMPLATE
10 {
    file = fileadmin/templates/MyTemplate.html
    variables {
        foo = TEXT
        foo.value = Hello World!
    }
}

 

Reference

Further properties of the FLUIDTEMPLATE cObject are:

  • layoutRootPath – relative or absolute path to the folder that contains Fluid layouts
  • partialRootPath – relative or absolute path to the folder that contains Fluid partials
  • format – default format that will be used for links (defaults to html)

Furthermore you can specify the default plugin values that are mainly used to search layouts/partials
(if layoutRootPath/partialRootPath have not been specified) and to resolve extension/controller in Fluid links.
Available extbase properties are:

  • extbase.pluginName
  • extbase.controllerExtensionName
  • extbase.controllerName
  • extbase.controllerActionName

Note: All properties of the FLUIDTEMPLATE cObject support stdWrap

A fully fledged example

10 = FLUIDTEMPLATE
10 {
    file = MyTemplate.html
    file.wrap = fileadmin/templates/ |
    layoutRootPath = fileadmin/templates/layouts
    partialRootPath = fileadmin/templates/partials
    format = xml
    extbase {
        pluginName = SomePlugin
        controllerExtensionName = SomeExtension
        controllerName = SomeController
        controllerActionName = someAction
    }
    variables {
        title = TEXT
        title.value = Some Title
        mainNavigation < lib.mainNavigation
    }
}

The corresponding Fluid template (fileadmin/templates/MyTemplate.html) could look like this:

 1 <f:layout name="Default" />
 2 
 3 <f:section name="header">
 4     <f:render partial="GraphicalHeader" arguments="{header: title}" />
 5 </f:section>
 6 <f:section name="body">
 7     <div id="mainNavigation">
 8         <f:format.html>{mainNavigation}</f:format.html>
 9     </div>
10     <div id="content">
11         <f:format.html>{data.bodytext}</f:format.html>
12     </div>
13 </f:section>

 

Fluid Standalone View

The FLUIDTEMPLATE content object internally uses the Fluid Standalone View, which can also be used by your own code
if you need to render Fluid (f.e. to render an e-mail text), as in the following example:

1 $view = t3lib_div::makeInstance('Tx_Fluid_View_StandaloneView');
2 $view->setTemplatePathAndFilename('foo/Bar.html');
3 $view->assign('key', 'value');
4 print $view->render();