Skip to content

Commit f1cfb40

Browse files
committed
working on twig.
1 parent 32b5964 commit f1cfb40

4 files changed

Lines changed: 20 additions & 2 deletions

File tree

app/bulbs/production.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,22 @@
1313

1414
$app['debug'] = false;
1515

16+
$viewPath = __DIR__.'/../views';
17+
18+
$app->register(new Silex\Provider\TwigServiceProvider, array(
19+
20+
'twig.path' => $viewPath,
21+
22+
'twig.options' => array(
23+
24+
'auto_reload' => true,
25+
26+
'cache' => $viewPath.'/cache'
27+
28+
),
29+
30+
));
31+
1632
/*
1733
|--------------------------------------------------------------------------
1834
| Register The Base Service Provider

app/routes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414

1515
$app->get('/', function() use ($app)
1616
{
17-
return 'Hello World!';
17+
return $app->twig->render('hello.twig.html');
1818
});

app/views/hello.twig.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<h1>Hello World!</h1>

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"require": {
3-
"illuminate/foundation": ">=1.0.0"
3+
"illuminate/foundation": ">=1.0.0",
4+
"twig/twig": "1.8.*"
45
}
56
}

0 commit comments

Comments
 (0)