Skip to content

Instantly share code, notes, and snippets.

@andypa
Last active January 26, 2018 04:53
Show Gist options
  • Save andypa/5045748 to your computer and use it in GitHub Desktop.
Save andypa/5045748 to your computer and use it in GitHub Desktop.
$this->extPath = t3lib_extMgm::extPath($this->extKey);
$view = t3lib_div::makeInstance('Tx_Fluid_View_StandaloneView');
$view->setLayoutRootPath(t3lib_extMgm::extPath($this->extKey) . 'Resources/Private/Layouts/');
$view->setPartialRootPath(t3lib_extMgm::extPath($this->extKey) . 'Resources/Private/Partials/');
$view->setTemplatePathAndFilename($this->extPath . 'Resources/Private/Templates/File.html');
// initialize locallang
$view->getRequest()->setControllerExtensionName($this->extKey);
$view->assign('helloworld', $helloworld);
$content = $view->render();
Private/Language/locallang.xml
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
<meta type="array">
<type>module</type>
<description>Language labels for plugin &quot;tx_extension_pi1&quot;</description>
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="test">Test</label>
</languageKey>
</data>
</T3locallang>
Private/Templates/File.html
{namespace v=Tx_Vhs_ViewHelpers}
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"
f:schemaLocation="http://fluidtypo3.org/schemas/fluid-master.xsd"
xmlns:v="http://typo3.org/ns/vhs/ViewHelpers"
v:schemaLocation="http://fluidtypo3.org/schemas/vhs-master.xsd">
{f:layout(name: 'Default')}
<head>
<title>Partials: MyPartial</title>
</head>
<body>
<f:section name="Main">
</f:section>
</body>
</html>
Private/Layouts/Default.html
<div class="tx-ic-contest">
<f:render section="Main" />
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment