Symfony

Created Thursday 29 May 2014

http://symfony.com/doc/current/book/index.html

acme_hello:
resource: "@AcmeHelloBundle/Resources/config/routing.yml"
prefix: /
hello:
path: /hello/{name}
defaults: { _controller: AcmeHelloBundle:Hello:index }
namespace Acme\HelloBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class HelloController extends Controller
{
public function indexAction($name)
{
return $this->render(
'AcmeHelloBundle:Hello:index.html.twig',
array('name' => $name)
);
}
}
{# src/Acme/HelloBundle/Resources/views/Hello/index.html.twig #}
{% extends '::base.html.twig' %}

{% block body %}
** Hello !**
{% endblock %}
{# app/Resources/views/base.html.twig #}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}{% endblock %}
** <link rel="shortcut icon" href="" />**
</head>
<body>
{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
</body>
</html>



Backlinks: