Skip to content

Commit

Permalink
[quick_tour][big_picture] Fixing up some spacing and a few minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverryan committed Mar 9, 2011
1 parent 1349a14 commit e188b2a
Showing 1 changed file with 30 additions and 27 deletions.
57 changes: 30 additions & 27 deletions quick_tour/the_big_picture.rst
Expand Up @@ -49,13 +49,13 @@ should now have a ``sandbox/`` directory::
Checking the Configuration
--------------------------

Symfony2 comes with a visual server configuration tester to help avoid some
Symfony2 comes with a visual server configuration tester to help avoid some
headaches that come from web server or PHP misconfiguration. Use the following
url to see the diagnostics for your server:

http://localhost/sandbox/web/check.php

Read the script output carefully and correct any oustanding issues.
Read the script output carefully and correct any oustanding issues.

Now you can request your first "real" Symfony2 webpage:

Expand Down Expand Up @@ -92,8 +92,8 @@ Fabien!``).
Configuration
~~~~~~~~~~~~~

Symfony2 configuration files can be written in PHP, XML or `YAML`_. The
different types are compatible and may be used interchangeably within an
Symfony2 configuration files can be written in PHP, XML or `YAML`_. The
different types are compatible and may be used interchangeably within an
application.

.. tip::
Expand Down Expand Up @@ -154,16 +154,17 @@ are a few examples of the routing configuration file for our application:
return $collection;
The first few lines of the routing configuration file define the code that is
executed when the user requests the resource specified by the pattern "``/``" (i.e. the homepage).
Here, it executes the "``index``" method of the "``Default``" controller inside the "``FrameworkBundle``"
The first few lines of the routing configuration file define the code that
is executed when the user requests the resource specified by the pattern
"``/``" (i.e. the homepage). Here, it executes the ``index`` method of
the ``Default`` controller inside the ``FrameworkBundle``.

Let's take a look at the last directive of
the configuration file: Symfony2 can include routing information from
other routing configuration files by using the ``import`` directive. In this
case, we want to import the routing configuration from ``HelloBundle``. A
bundle is like a plugin that has added power and we'll talk more about them
later. For now, let's look at the routing configuration that we've imported:
Take a look at the last directive of the configuration file: Symfony2 can
include routing information from other routing configuration files by using
the ``import`` directive. In this case, we want to import the routing configuration
from ``HelloBundle``. A bundle is like a plugin that has added power and
we'll talk more about them later. For now, let's look at the routing configuration
that we've imported:

.. configuration-block::

Expand Down Expand Up @@ -202,8 +203,9 @@ later. For now, let's look at the routing configuration that we've imported:
return $collection;
As you can see, the "``/hello/{name}``" resource pattern is mapped to a controller,
referenced by the ``_controller`` value. The string enclosed in curly brackets (``{name}``) is a placeholder
and defines an argument that will be available in the controller.
referenced by the ``_controller`` value. The string enclosed in curly brackets
(``{name}``) is a placeholder and defines an argument that will be available
in the controller.

.. index::
single: Controller
Expand Down Expand Up @@ -235,20 +237,21 @@ The controller defines actions to handle users requests and prepares responses
}
}
Let's explain this code line by line:
The code is pretty straightforward but let's explain it line by line:

* *line 3*: Symfony2 takes advantage of new PHP 5.3 namespacing features,
and all controllers should be properly namespaced. As you can see, the namespace has
a correlation to the actual file location. This is not required, but a best practice.
In this example, the controller lives in the bundle named ``HelloBundle``,
which forms the first part of the ``_controller`` routing value.
and all controllers should be properly namespaced. As you can see, the
namespace has a correlation to the actual file location. In this example,
the controller lives in the bundle named ``HelloBundle``, which forms the
first part of the ``_controller`` routing value.


* *line 7*: The controller name is the combination of the second part of the
``_controller`` routing value (``Hello``) and the word ``Controller``. It
extends the built-in ``Controller`` class, which provides useful shortcuts
(as we will see later in this tutorial). The ``Controller`` resides in ``Symfony\Bundle\FrameworkBundle\Controller\Controller``
which we defined in line 5
(as we will see later in this tutorial). The ``Controller`` resides in
``Symfony\Bundle\FrameworkBundle\Controller\Controller`` which we defined
on line 5.

* *line 9*: Each controller consists of several actions. As per the routing
configuration, the hello page is handled by the ``index`` action (the third
Expand All @@ -272,7 +275,7 @@ developers. In our example, we only have one bundle, ``HelloBundle``.
Templates
~~~~~~~~~

The controller renders the ``HelloBundle:Hello:index.html.twig`` template. By
The controller renders the ``HelloBundle:Hello:index.html.twig`` template. By
default, the sandbox uses Twig as its template engine but you can also use
traditional PHP templates if you choose.

Expand Down Expand Up @@ -327,9 +330,9 @@ your changes will appear immediately.
Final Thoughts
--------------

Thanks for trying out Symfony2! By now, you should be able to create your own
simple routes, controllers and templates. As an exercise, try to build
something more useful than the Hello application! If you are eager to
Thanks for trying out Symfony2! By now, you should be able to create your own
simple routes, controllers and templates. As an exercise, try to build
something more useful than the Hello application! If you are eager to
learn more about Symfony2, dive into the next section: "The View".

This comment has been minimized.

Copy link
@weaverryan

weaverryan Mar 10, 2011

Author Member

We've left it out here because it's added naturally at the bottom of the document when it's rendered (http://symfony.com/doc/2.0/quick_tour/the_big_picture.html#final-thoughts). Does that fit what you're looking for?

Thanks!


.. _sandbox: http://symfony-reloaded.org/code#sandbox
Expand Down

0 comments on commit e188b2a

Please sign in to comment.