diff --git a/app/config/routing_dev.yml b/app/config/routing_dev.yml index c45f361..d0d75fc 100755 --- a/app/config/routing_dev.yml +++ b/app/config/routing_dev.yml @@ -16,3 +16,7 @@ _main: # AcmeDemoBundle routes (to be removed) _acme_demo: resource: "@AcmeDemoBundle/Resources/config/routing.yml" + +# Including my routes resource to routing_dev.yml +myrouting: + resource: "@AcmeDemoBundle/Resources/config/myrouting.yml" diff --git a/src/Acme/DemoBundle/Controller/MyController.php b/src/Acme/DemoBundle/Controller/MyController.php new file mode 100644 index 0000000..6199d41 --- /dev/null +++ b/src/Acme/DemoBundle/Controller/MyController.php @@ -0,0 +1,47 @@ +render('AcmeDemoBundle:Welcome:index.html.twig'); + } + + public function secondAction() + { + /* + * The action's view can be rendered using render() method + * or @Template annotation as demonstrated in DemoController. + * + */ + return $this->render('AcmeDemoBundle:SimpleTemplate:simple.html.twig'); + } + + public function thirdAction() + { + /* + * The action's view can be rendered using render() method + * or @Template annotation as demonstrated in DemoController. + * + */ + return $this->render('AcmeDemoBundle:ExtendingTemplate:extending.html.twig'); + } +} \ No newline at end of file diff --git a/src/Acme/DemoBundle/Resources/config/myrouting.yml b/src/Acme/DemoBundle/Resources/config/myrouting.yml new file mode 100755 index 0000000..add8801 --- /dev/null +++ b/src/Acme/DemoBundle/Resources/config/myrouting.yml @@ -0,0 +1,11 @@ +simple_response: + pattern: /1/{name} + defaults: { _controller: AcmeDemoBundle:My:first, name: "noob :)" } + +simple_template: + pattern: /2 + defaults: { _controller: AcmeDemoBundle:My:second } + +extending_response: + pattern: /3 + defaults: { _controller: AcmeDemoBundle:My:third } diff --git a/src/Acme/DemoBundle/Resources/views/ExtendingTemplate/extending.html.twig b/src/Acme/DemoBundle/Resources/views/ExtendingTemplate/extending.html.twig new file mode 100755 index 0000000..243ae70 --- /dev/null +++ b/src/Acme/DemoBundle/Resources/views/ExtendingTemplate/extending.html.twig @@ -0,0 +1,41 @@ +{% extends "TwigBundle::layout.html.twig" %} + +{% block head %} + + +{% endblock %} + +{% block title 'Rendered template that extends base template' %} + +{% block body %} + {% for flashMessage in app.session.flashbag.get('notice') %} +
+ {% endfor %} + + {% block content_header %} + + + + {% endblock %} + +Result of the 3nd action in advanced controller, + which returns rendered template + that extends base template
+ {% endblock %} ++ Simple html. Result of the 2nd action in advanced controller, + which returns rendered simple template +
+ + + \ No newline at end of file diff --git a/web/.htaccess b/web/.htaccess index 0c5f37d..d0c145b 100755 --- a/web/.htaccess +++ b/web/.htaccess @@ -3,7 +3,7 @@ # mod_rewrite). Additionally, this reduces the matching process for the # start page (path "/") because otherwise Apache will apply the rewriting rules # to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl). -DirectoryIndex app.php +DirectoryIndex app_dev.php