-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
path() explanation inside templating + Minor formatting changes #6218
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1162,11 +1162,11 @@ each separated by a colon: | |
|
||
For example, a ``_controller`` value of ``AppBundle:Blog:show`` means: | ||
|
||
========= ================== ============== | ||
Bundle Controller Class Method Name | ||
========= ================== ============== | ||
AppBundle ``BlogController`` ``showAction`` | ||
========= ================== ============== | ||
============= ================== ============== | ||
Bundle Controller Class Method Name | ||
============= ================== ============== | ||
``AppBundle`` ``BlogController`` ``showAction`` | ||
============= ================== ============== | ||
|
||
The controller might look like this:: | ||
|
||
|
@@ -1461,7 +1461,7 @@ system. Take the ``blog_show`` example route from earlier:: | |
// /blog/my-blog-post | ||
|
||
To generate a URL, you need to specify the name of the route (e.g. ``blog_show``) | ||
and any wildcards (e.g. ``slug = my-blog-post``) used in the path for that | ||
and any wildcards (e.g. ``slug`` = ``my-blog-post``) used in the path for that | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, we would like to point out the whole expression, so the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For me, it looks like an assignment operation. :) |
||
route. With this information, any URL can easily be generated:: | ||
|
||
class MainController extends Controller | ||
|
@@ -1500,7 +1500,7 @@ In an upcoming section, you'll learn how to generate URLs from inside templates. | |
|
||
var url = Routing.generate( | ||
'blog_show', | ||
{"slug": 'my-blog-post'} | ||
{'slug': 'my-blog-post'} | ||
); | ||
|
||
For more information, see the documentation for that bundle. | ||
|
@@ -1547,6 +1547,8 @@ a template helper function: | |
The ``path()`` PHP templating helper was introduced in Symfony 2.8. Prior | ||
to 2.8, you had to use the ``generate()`` helper method. | ||
|
||
The ``path()`` method generates relative URLs. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should "blend" this into the paragraph before the code block, instead of a lost sentence somewhere at the end of the section. What about changing the paragraph to: The most common place to generate a URL is from within a template when linking
between pages in your application. This is done just as before, but using
- a template helper function:
+ the ``path()`` function to generate a relative URI: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good. |
||
|
||
.. index:: | ||
single: Routing; Absolute URLs | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a matter of consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree to make this change for the class name and method name. However, do we do the same with bundle names somewhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm usually against using literals for bundle names (as it's a name and not code). However, in this case, the table is used to explain the
AppBundle:Blog:show
logical name. I think it makes sense to put it in a literal, as it's just the logical name broken into 3 seperate pieces.