Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed various typos; made minor tweaks

  • Loading branch information...
commit b9015455081c7e57692168994bd5aa536aa2a56e 1 parent ce5f697
@fabpot fabpot authored
View
2  guides/security/users.rst
@@ -274,7 +274,7 @@ implement :class:`Symfony\\Component\\Security\\User\\UserProviderInterface`::
implementation.
Doctrine Document Provider
-~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~
Most of the time, users are described by a Doctrine Document::
View
22 guides/templating/Twig.rst
@@ -5,8 +5,8 @@
Twig & Symfony2
===============
-`Twig`_ is a flexible, fast, and secure template language for PHP. Symfony2 has
-native support for Twig through ``TwigBundle``.
+`Twig`_ is a flexible, fast, and secure template language for PHP. Symfony2
+has native support for Twig through ``TwigBundle``.
.. index::
single: Twig; Installation
@@ -67,8 +67,8 @@ Then, configure it:
The configuration options are the same as the ones you pass to the
``Twig_Environment`` `constructor`_.
-Usage
------
+Rendering Twig Templates
+------------------------
To render a Twig template instead of a PHP one, add the ``.twig`` suffix at the
end of the template name. The controller below renders the ``index.twig``
@@ -107,8 +107,8 @@ And here is a typical layout:
</body>
</html>
-Include other Templates
------------------------
+Including other Templates
+-------------------------
The best way to share a snippet of code between several distinct templates is
to define a template that can then be included into another one.
@@ -138,10 +138,10 @@ And change the ``index.twig`` template to include it:
{% render 'HelloBundle:Hello:sidebar.php' %}
-Embed other Actions
--------------------
+Embedding other Controllers
+---------------------------
-And what if you want to embed the result of another action in a template?
+And what if you want to embed the result of another controller in a template?
That's very useful when working with Ajax, or when the embedded template needs
some variable not available in the main template.
@@ -175,8 +175,8 @@ values::
.. index::
single: Twig; Helpers
-Template Helpers
-----------------
+Using Template Helpers
+----------------------
The default Symfony2 helpers are available within a Twig template via
specialized tags:
View
6 quick_tour/the_architecture.rst
@@ -385,8 +385,8 @@ applications, store them locally or globally, your choice.
.. index::
single: Vendors
-Vendors
--------
+Using Vendors
+-------------
Odds are your application will depend on third-party libraries. Those should
be stored in the ``src/vendor/`` directory. It already contains the Symfony2
@@ -394,7 +394,7 @@ libraries, the SwiftMailer library, the Doctrine ORM, the Propel ORM, the Twig
templating system, and a selection of the Zend Framework classes.
.. index::
- single: Cache
+ single: Configuration Cache
single: Logs
Cache and Logs
View
38 quick_tour/the_big_picture.rst
@@ -12,8 +12,8 @@ with Symfony2.
.. index::
pair: Sandbox; Download
-Download and Install
---------------------
+Downloading and Installing Symfony2
+-----------------------------------
First, check that you have at least PHP 5.3.2 installed and correctly
configured to work with a web server like Apache.
@@ -46,8 +46,8 @@ should now have a ``sandbox/`` directory::
.. index::
single: Installation; Check
-Check the Configuration
------------------------
+Checking the Configuration
+--------------------------
To avoid some headaches further down the line, check that your configuration
can run a Symfony2 project smoothly by requesting the following URL:
@@ -62,8 +62,8 @@ Now, request your first "real" Symfony2 webpage:
Symfony2 should congratulate you for your hard work so far!
-Your first Application
-----------------------
+Creating your first Application
+-------------------------------
The sandbox comes with a simple Hello World ":term:`application`" and that's
the application we will use to learn more about Symfony2. Go to the following
@@ -99,9 +99,10 @@ All Symfony2 configuration files can be written in either PHP, XML, or `YAML`_
very easy).
.. tip::
+
The sandbox defaults to YAML, but you can easily switch to XML or PHP by
- editing the ``app/AppKernel.php`` file. You can switch now by looking at the
- bottom of ``app/AppKernel.php`` for instructions (the tutorials show the
+ editing the ``app/AppKernel.php`` file. You can switch now by looking at
+ the bottom of this file for instructions (the tutorials show the
configuration for all supported formats).
.. index::
@@ -223,9 +224,13 @@ The controller is responsible for returning a representation of the resource
public function indexAction($name)
{
return $this->render('HelloBundle:Hello:index.php', array('name' => $name));
+
+ // render a Twig template instead
+ // return $this->render('HelloBundle:Hello:index.twig', array('name' => $name));
}
}
+
The code is pretty straightforward but let's explain this code line by line:
* *line 3*: Symfony2 takes advantage of new PHP 5.3 features and as such, all
@@ -262,7 +267,7 @@ is made of HTML and simple PHP expressions:
.. code-block:: html+php
- # src/Application/HelloBundle/Resources/views/Hello/index.php
+ <!-- src/Application/HelloBundle/Resources/views/Hello/index.php -->
<?php $view->extend('HelloBundle::layout.php') ?>
Hello <?php echo $name ?>!
@@ -275,8 +280,8 @@ better and faster.
single: Environment
single: Configuration; Environment
-Environments
-------------
+Working with Environments
+-------------------------
Now that you have a better understanding on how Symfony2 works, have a closer
look at the bottom of the page; you will notice a small bar with the Symfony2
@@ -288,8 +293,8 @@ production environment:
http://localhost/sandbox/web/index.php/hello/Fabien
-And if you have ``mod_rewrite`` installed, you can even omit the ``index.php``
-part of the URL:
+And if you use Apache with ``mod_rewrite`` enabled, you can even omit the
+``index.php`` part of the URL:
http://localhost/sandbox/web/hello/Fabien
@@ -300,9 +305,10 @@ better looking URL:
http://localhost/hello/Fabien
To make the production environment as fast as possible, Symfony2 maintains a
-cache under the ``app/cache/`` directory. When you make changes, you need to
-manually remove the cached files. That's why you should always use the
-development front controller (``index_dev.php``) when working on a project.
+cache under the ``app/cache/`` directory. When you make changes to the code or
+configuration, you need to manually remove the cached files. That's why you
+should always use the development front controller (``index_dev.php``) when
+working on a project.
Final Thoughts
--------------
View
8 quick_tour/the_controller.rst
@@ -14,8 +14,8 @@ addict! Without further ado, let's discover what controllers can do for you.
single: Routing; Formats
single: View; Formats
-Formats
--------
+Using Formats
+-------------
Nowadays, a web application should be able to deliver more than just HTML
pages. From XML for RSS feeds or Web Services, to JSON for Ajax requests,
@@ -141,8 +141,8 @@ an Ajax request.
.. index::
single: Exceptions
-Error Management
-----------------
+Managing Errors
+---------------
When things are not found, you should play well with the HTTP protocol and
return a 404 response. This is easily done by throwing a built-in HTTP
View
48 quick_tour/the_view.rst
@@ -19,7 +19,7 @@ Decorating Templates
--------------------
More often than not, templates in a project share common elements, like the
-well-know header and footer. In Symfony2, we like to think about this problem
+well-known header and footer. In Symfony2, we like to think about this problem
differently: a template can be decorated by another one.
The ``index.php`` template is decorated by ``layout.php``, thanks to the
@@ -74,15 +74,14 @@ replaced by the content of the child template, ``index.php`` and
As you can see, Symfony2 provides methods on a mysterious ``$view`` object. In
a template, the ``$view`` variable is always available and refers to a special
-object that provides a bunch of methods and properties that make the template
-engine tick.
+object that provides a bunch of methods that makes the template engine tick.
.. index::
single: Templating; Slot
single: Slot
-Slots
------
+Working with Slots
+------------------
A slot is a snippet of code, defined in a template, and reusable in any layout
decorating the template. In the ``index.php`` template, define a ``title`` slot:
@@ -92,7 +91,7 @@ decorating the template. In the ``index.php`` template, define a ``title`` slot:
<!-- src/Application/HelloBundle/Resources/views/Hello/index.php -->
<?php $view->extend('HelloBundle::layout.php') ?>
- <?php $view['slots']->set('title', 'Hello World app') ?>
+ <?php $view['slots']->set('title', 'Hello World Application') ?>
Hello <?php echo $name ?>!
@@ -121,11 +120,11 @@ For large slots, there is also an extended syntax:
.. index::
single: Templating; Include
-Include other Templates
------------------------
+Including other Templates
+-------------------------
-The best way to share a snippet of code between several distinct templates is
-to define a template that can then be included into another one.
+The best way to share a snippet of template code is to define a template that
+can then be included into other templates.
Create a ``hello.php`` template:
@@ -149,10 +148,10 @@ The ``render()`` method evaluates and returns the content of another template
.. index::
single: Templating; Embedding Pages
-Embed other Actions
--------------------
+Embedding other Controllers
+---------------------------
-And what if you want to embed the result of another action in a template?
+And what if you want to embed the result of another controller in a template?
That's very useful when working with Ajax, or when the embedded template needs
some variable not available in the main template.
@@ -162,7 +161,7 @@ template, simply use the following code:
.. code-block:: html+php
<!-- src/Application/HelloBundle/Resources/views/Hello/index.php -->
- <?php $view['actions']->output('HelloBundle:Hello:fancy', array('name' => $name, 'color' => 'green')) ?>
+ <?php echo $view['actions']->render('HelloBundle:Hello:fancy', array('name' => $name, 'color' => 'green')) ?>
Here, the ``HelloBundle:Hello:fancy`` string refers to the ``fancy`` action of the
``Hello`` controller::
@@ -189,20 +188,20 @@ you more about those.
.. index::
single: Templating; Helpers
-Template Helpers
-----------------
+Using Template Helpers
+----------------------
The Symfony2 templating system can be easily extended via helpers. Helpers are
PHP objects that provide features useful in a template context. ``actions`` and
``slots`` are two of the built-in Symfony2 helpers.
-Links between Pages
-~~~~~~~~~~~~~~~~~~~
+Creating Links between Pages
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Speaking of web applications, creating links between different pages is a must.
-Instead of hardcoding URLs in templates, the ``router`` helper knows how to
-generate URLs based on the routing configuration. That way, all your URLs can
-be easily updated by changing the configuration:
+Speaking of web applications, creating links between pages is a must. Instead
+of hardcoding URLs in templates, the ``router`` helper knows how to generate
+URLs based on the routing configuration. That way, all your URLs can be easily
+updated by changing the configuration:
.. code-block:: html+php
@@ -210,9 +209,10 @@ be easily updated by changing the configuration:
Greet Thomas!
</a>
-The ``generate()`` method takes the route name and an array of values as
+The ``generate()`` method takes the route name and an array of paremeters as
arguments. The route name is the main key under which routes are referenced
-and the values are the route pattern placeholder values:
+and the parameters are the values of the placeholders defined in the route
+pattern:
.. code-block:: yaml
Please sign in to comment.
Something went wrong with that request. Please try again.