Skip to content

Grammar fixes in front_controller.rst #15875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions create_framework/front_controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ not feel like a good abstraction, does it? We still have the ``send()`` method
for all pages, our pages do not look like templates and we are still not able
to test this code properly.

Moreover, adding a new page means that we need to create a new PHP script,
which name is exposed to the end user via the URL
(``http://127.0.0.1:4321/bye.php``): there is a direct mapping between the PHP
Moreover, adding a new page means that we need to create a new PHP script, the name of
which is exposed to the end user via the URL
(``http://127.0.0.1:4321/bye.php``). There is a direct mapping between the PHP
script name and the client URL. This is because the dispatching of the request
is done by the web server directly. It might be a good idea to move this
dispatching to our code for better flexibility. This can be achieved by routing
Expand Down Expand Up @@ -105,7 +105,7 @@ In the ``front.php`` script, ``$map`` associates URL paths with their
corresponding PHP script paths.

As a bonus, if the client asks for a path that is not defined in the URL map,
we return a custom 404 page; you are now in control of your website.
we return a custom 404 page. You are now in control of your website.

To access a page, you must now use the ``front.php`` script:

Expand Down Expand Up @@ -133,7 +133,7 @@ its sub-directories (only if needed -- see above tip).
argument is the URL path you want to simulate.

Now that the web server always accesses the same script (``front.php``) for all
pages, we can secure the code further by moving all other PHP files outside the
pages, we can secure the code further by moving all other PHP files outside of the
web root directory:

.. code-block:: text
Expand All @@ -151,7 +151,7 @@ web root directory:
└── front.php

Now, configure your web server root directory to point to ``web/`` and all
other files won't be accessible from the client anymore.
other files will no longer be accessible from the client.

To test your changes in a browser (``http://localhost:4321/hello?name=Fabien``),
run the :doc:`Symfony Local Web Server </setup/symfony_server>`:
Expand All @@ -166,7 +166,7 @@ run the :doc:`Symfony Local Web Server </setup/symfony_server>`:
various PHP files; the changes are left as an exercise for the reader.

The last thing that is repeated in each page is the call to ``setContent()``.
We can convert all pages to "templates" by just echoing the content and calling
We can convert all pages to "templates" by echoing the content and calling
the ``setContent()`` directly from the front controller script::

// example.com/web/front.php
Expand Down