Last active
August 29, 2015 14:17
-
-
Save stmllr/14436c35b5a1b16fef7c to your computer and use it in GitHub Desktop.
Proof-of-concept: Using TYPO3.Fluid as view in Slim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"repositories": [ | |
{ | |
"type": "vcs", | |
"url": "https://github.com/NamelessCoder/TYPO3.Fluid" | |
} | |
], | |
"require": { | |
"slim/slim": "dev-develop", | |
"typo3/fluid": "dev-master" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ php -S localhost:8000 index.php | |
$ curl http://localhost:8000/hello/world | |
<html> | |
<body> | |
<h1>Rendered with TYPO3.Fluid</h1> | |
Hello world | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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