Skip to content

Instantly share code, notes, and snippets.

@stmllr
Last active August 29, 2015 14:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stmllr/14436c35b5a1b16fef7c to your computer and use it in GitHub Desktop.
Save stmllr/14436c35b5a1b16fef7c to your computer and use it in GitHub Desktop.
Proof-of-concept: Using TYPO3.Fluid as view in Slim
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/NamelessCoder/TYPO3.Fluid"
}
],
"require": {
"slim/slim": "dev-develop",
"typo3/fluid": "dev-master"
}
}
<?php
require 'vendor/autoload.php';
$app = new \Slim\App();
$app->get('/hello/{name}', function ($request, $response, $args) {
$paths = new \TYPO3\Fluid\View\TemplatePaths();
$view = new \TYPO3\Fluid\View\TemplateView($paths);
$view->assign('name', $args['name']);
$view->setTemplatePathAndFilename(__DIR__ . '/templates/single.html');
echo $view->render();
});
$app->run();
$ php -S localhost:8000 index.php
$ curl http://localhost:8000/hello/world
<html>
<body>
<h1>Rendered with TYPO3.Fluid</h1>
Hello world
</body>
</html>
<html>
<body>
<h1>Rendered with TYPO3.Fluid</h1>
Hello {name}
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment