Created
November 28, 2015 17:17
-
-
Save Rayne/71bae67f0e1d804d1ed3 to your computer and use it in GitHub Desktop.
Fat-Free Framework: Templating with objects and the `Template` class
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
<repeat group="{{ @articles }}" value="{{ @article }}"> | |
<h1>{{ @article->title }}</h1> | |
</repeat> |
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 | |
/** | |
* @see https://github.com/bcosca/fatfree/issues/891 | |
*/ | |
$f3->route('GET /articles', function(Base $f3) { | |
$articles = []; | |
$article = new \stdClass; | |
$article->title = 'A'; | |
$articles[] = $article; | |
$article = new \stdClass; | |
$article->title = 'B'; | |
$articles[] = $article; | |
echo Template::instance()->render('articles.html', null, ['articles' => $articles]); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment