From 6fdc65697aa35782f2e427d92b37eb443b598adc Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 19 Aug 2010 15:35:30 +0200 Subject: [PATCH] fixed Twig templates and added a global layout (which is probably closer to what you would do in a real application) --- hello/views/layout.php | 10 ++++++++++ hello/views/layout.twig | 10 ++++++++++ .../HelloBundle/Resources/views/Hello/index.twig | 4 +++- .../HelloBundle/Resources/views/layout.php | 14 +++++--------- .../HelloBundle/Resources/views/layout.twig | 16 +++++++--------- src/autoload.php | 2 +- web/index.php | 9 +++++++++ 7 files changed, 45 insertions(+), 20 deletions(-) create mode 100644 hello/views/layout.php create mode 100644 hello/views/layout.twig diff --git a/hello/views/layout.php b/hello/views/layout.php new file mode 100644 index 00000000..b9433ef9 --- /dev/null +++ b/hello/views/layout.php @@ -0,0 +1,10 @@ + + + + + <?php $view->slots->output('title', 'Hello Application') ?> + + + slots->output('_content') ?> + + diff --git a/hello/views/layout.twig b/hello/views/layout.twig new file mode 100644 index 00000000..7873bbc3 --- /dev/null +++ b/hello/views/layout.twig @@ -0,0 +1,10 @@ + + + + + {% block title %}Hello Application{% endblock %} + + + {% block body %}{% endblock %} + + diff --git a/src/Application/HelloBundle/Resources/views/Hello/index.twig b/src/Application/HelloBundle/Resources/views/Hello/index.twig index b7a65f2b..1fc4bb8f 100644 --- a/src/Application/HelloBundle/Resources/views/Hello/index.twig +++ b/src/Application/HelloBundle/Resources/views/Hello/index.twig @@ -1,3 +1,5 @@ {% extends "HelloBundle::layout" %} -Hello {{ $name }}! +{% block content %} + Hello {{ name }}! +{% endblock %} diff --git a/src/Application/HelloBundle/Resources/views/layout.php b/src/Application/HelloBundle/Resources/views/layout.php index 0a200553..98b54cb0 100644 --- a/src/Application/HelloBundle/Resources/views/layout.php +++ b/src/Application/HelloBundle/Resources/views/layout.php @@ -1,9 +1,5 @@ - - - - - - - slots->output('_content') ?> - - +extend('::layout') ?> + +

Hello Application

+ +slots->output('_content') ?> diff --git a/src/Application/HelloBundle/Resources/views/layout.twig b/src/Application/HelloBundle/Resources/views/layout.twig index 1df92a8d..9332237f 100644 --- a/src/Application/HelloBundle/Resources/views/layout.twig +++ b/src/Application/HelloBundle/Resources/views/layout.twig @@ -1,9 +1,7 @@ - - - - - - - {% block body %}{% endblock %} - - +{% extends "::layout" %} + +{% block body %} +

Hello Application

+ + {% block content %}{% endblock %} +{% endblock %} diff --git a/src/autoload.php b/src/autoload.php index aa1b82f6..5033cdd7 100644 --- a/src/autoload.php +++ b/src/autoload.php @@ -1,6 +1,6 @@ handle()->send(); + +$xhprof_data = xhprof_disable(); +include_once "/Users/fabien/work/symfony/2_0/blog/web/xhprof-0.9.2/xhprof_lib/utils/xhprof_lib.php"; +include_once "/Users/fabien/work/symfony/2_0/blog/web/xhprof-0.9.2/xhprof_lib/utils/xhprof_runs.php"; +$xhprof_runs = new XHProfRuns_Default(); +$run_id = $xhprof_runs->save_run($xhprof_data, "PR2", 1); +echo "http:///index.php?run=$run_id&source=products\n";