added documentation for the new absolute_url() and relative_path() Twig functions#4805
Merged
weaverryan merged 1 commit intosymfony:masterfrom Jan 25, 2015
Merged
Conversation
Member
fabpot
commented
Jan 10, 2015
| Q | A |
|---|---|
| Doc fix? | no |
| New docs? | symfony/symfony#13264 |
| Applies to | 2.7 |
| Fixed tickets | n/a |
fabpot
added a commit
to symfony/symfony
that referenced
this pull request
Jan 10, 2015
This PR was merged into the 2.7 branch. Discussion ---------- URL manipulations as a Twig extension | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | symfony/symfony-docs#4805 While working on the new asset component, I realized that the "absolute URL" feature was misplaced and would benefit from being exposed as a Twig function (composition is always a good thing). Then, I wondered if having a Twig function to generate a relative path (like done by the Routing component would also make sense). And here is the corresponding PR. ```jinja {# generate an absolute URL for the given absolute path #} {{ absolute_url('/me.png') }} {# generate a relative path for the given absolute path (based on the current Request) #} {{ relative_path('/foo/me.png') }} {# compose as you see fit #} {{ absolute_url(asset('me.png')) }} ``` As you can see, we require an absolute path for both functions (and we even add the leading slash if it is omitted), not sure if we want to do otherwise. ping @Tobion Commits ------- 0ec852d added a relative_path Twig function ee27ed8 added an absolute_url() Twig function
fabpot
added a commit
to symfony/twig-bridge
that referenced
this pull request
Jan 10, 2015
This PR was merged into the 2.7 branch. Discussion ---------- URL manipulations as a Twig extension | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | symfony/symfony-docs#4805 While working on the new asset component, I realized that the "absolute URL" feature was misplaced and would benefit from being exposed as a Twig function (composition is always a good thing). Then, I wondered if having a Twig function to generate a relative path (like done by the Routing component would also make sense). And here is the corresponding PR. ```jinja {# generate an absolute URL for the given absolute path #} {{ absolute_url('/me.png') }} {# generate a relative path for the given absolute path (based on the current Request) #} {{ relative_path('/foo/me.png') }} {# compose as you see fit #} {{ absolute_url(asset('me.png')) }} ``` As you can see, we require an absolute path for both functions (and we even add the leading slash if it is omitted), not sure if we want to do otherwise. ping @Tobion Commits ------- 0ec852d added a relative_path Twig function ee27ed8 added an absolute_url() Twig function
fabpot
added a commit
to symfony/twig-bundle
that referenced
this pull request
Jan 10, 2015
This PR was merged into the 2.7 branch. Discussion ---------- URL manipulations as a Twig extension | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | symfony/symfony-docs#4805 While working on the new asset component, I realized that the "absolute URL" feature was misplaced and would benefit from being exposed as a Twig function (composition is always a good thing). Then, I wondered if having a Twig function to generate a relative path (like done by the Routing component would also make sense). And here is the corresponding PR. ```jinja {# generate an absolute URL for the given absolute path #} {{ absolute_url('/me.png') }} {# generate a relative path for the given absolute path (based on the current Request) #} {{ relative_path('/foo/me.png') }} {# compose as you see fit #} {{ absolute_url(asset('me.png')) }} ``` As you can see, we require an absolute path for both functions (and we even add the leading slash if it is omitted), not sure if we want to do otherwise. ping @Tobion Commits ------- 0ec852d added a relative_path Twig function ee27ed8 added an absolute_url() Twig function
fabpot
added a commit
to symfony/http-foundation
that referenced
this pull request
Jan 10, 2015
This PR was merged into the 2.7 branch. Discussion ---------- URL manipulations as a Twig extension | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | symfony/symfony-docs#4805 While working on the new asset component, I realized that the "absolute URL" feature was misplaced and would benefit from being exposed as a Twig function (composition is always a good thing). Then, I wondered if having a Twig function to generate a relative path (like done by the Routing component would also make sense). And here is the corresponding PR. ```jinja {# generate an absolute URL for the given absolute path #} {{ absolute_url('/me.png') }} {# generate a relative path for the given absolute path (based on the current Request) #} {{ relative_path('/foo/me.png') }} {# compose as you see fit #} {{ absolute_url(asset('me.png')) }} ``` As you can see, we require an absolute path for both functions (and we even add the leading slash if it is omitted), not sure if we want to do otherwise. ping @Tobion Commits ------- 0ec852d added a relative_path Twig function ee27ed8 added an absolute_url() Twig function
Member
|
👍 |
1 similar comment
Member
|
👍 |
reference/twig_reference.rst
Outdated
Member
There was a problem hiding this comment.
This line reads a bit strange to me:
the relative path for path ``/article/image.png`` is ``../images.png``.
What about using this instead:
the relative path for ``/article/image.png`` path is ``../images.png``.
Member
There was a problem hiding this comment.
I would remove the second "path" completely: "the relative path for /article/image.png is ../images.png"
54e74ac to
e4d22f0
Compare
Member
|
👍 again, it's ready! |
weaverryan
added a commit
that referenced
this pull request
Jan 25, 2015
…tive_path() Twig functions (fabpot) This PR was merged into the master branch. Discussion ---------- added documentation for the new absolute_url() and relative_path() Twig functions | Q | A | ------------- | --- | Doc fix? | no | New docs? | symfony/symfony#13264 | Applies to | 2.7 | Fixed tickets | n/a Commits ------- e4d22f0 added documentation for the new absolute_url() and relative_path() Twig functions
Contributor
|
Thanks! FYI - I merged this too quickly into master, but cherry-picked back to 2.7 at sha: 8fe9069 |
weaverryan
added a commit
that referenced
this pull request
Jan 25, 2015
weaverryan
added a commit
that referenced
this pull request
Jan 25, 2015
* 2.7: [#4805] Adding versionadded added documentation for the new absolute_url() and relative_path() Twig functions Remove 'acme' Update routing.rst [#4786] Adding a few versionadded's for the changed method name Replaced setDefaultOptions by the new configureOptions method Typo Update introduction.rst [Book][Translation] Added tip for routing params [varnish] be more precise about version differences Remove trailing whitespace [BestPractices] fix minor typo Remove horizontal scrollbar [Components][Debug] fix DebugClassLoader namespace Update override.rst Update override.rst [Book][Security] add back old anchors [Cookbook][Security] Hint about createToken can return null Add version added note for the debug:event-dispatcher command Conflicts: reference/twig_reference.rst
wouterj
added a commit
that referenced
this pull request
Feb 14, 2015
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #4977). Discussion ---------- Unnecessary comma Commits ------- 8a2f0ba Wrong comma 81e8c13 Merge branch '2.7' ef39a01 Remove diff 8d56ad7 Merge branch '2.7' 6fd286b Added January changelog ad97700 Merge branch '2.7' c0f9f67 Merge branch '2.7' 87eb36c Merge branch '2.7' 714f630 Merge branch '2.7' 99e2996 Merge branch '2.7' c33b371 Merge branch '2.7' 6c498d4 feature #4805 added documentation for the new absolute_url() and relative_path() Twig functions (fabpot) e4d22f0 added documentation for the new absolute_url() and relative_path() Twig functions 907ee0d Merge branch '2.7' a17bdd7 Merge branch '2.7' ca3b4c8 feature #4753 bump Symfony requirements to PHP 5.5 (xabbuh) 9919bca Revert "Fixed markup" c859790 Fixed markup 032a6b4 Merge branch '2.7' 92b10b1 bug #4758 [Components][Yaml] don't describe removed usage of Yaml::parse() (xabbuh) 42d2b15 Merge branch '2.7' 6f9832d Merge branch '2.7' d33b78b don't describe removed usage of Yaml::parse() bcab77b bump Symfony requirements to PHP 5.5 6ef6a04 Merge branch '2.7' fcfea43 Merge branch '2.7' 353995e Merge branch '2.7' 27296ad Merge branch '2.7' 56db7af Merge branch '2.7' 9e5fc6c Merge branch '2.7' cb6f846 Merge branch '2.7' 8131844 Merge branch '2.7' 2fcebc1 Merge branch '2.7' 07aa543 Merge branch '2.7' 4056218 Merge branch '2.7' 0906e0c Merge branch '2.7' e539bd1 Merge branch '2.7' 2d1c336 Merge branch '2.7' d30dc9e Merge remote-tracking branch 'origin/master' 3454883 Merge branch '2.7' f0ac8bb Merge branch '2.7' d921dcd Merge branch '2.7' 486baf8 Merge branch '2.7' 8099ac1 Merge branch '2.7' 6b73990 Merge branch '2.7' 0fb81cc Merge branch '2.7' d969e8b Merge branch '2.7' f24b645 Merge branch '2.7' d6ce29f Merge branch '2.7' 51224e9 Merge branch '2.7' 0c92fab Merge branch '2.7' 0d5cb0d Merge branch '2.7' 3329bd2 feature #4424 [#4243] Tweaks to the new var-dumper component (weaverryan, nicolas-grekas) 9caea6f feature #4336 [Form] Add entity manager instance support for em option (egeloen) 1a29f24 typos in the var-dumper component 09a6fd7 [Form] Add entity manager instance support for em option 265604b [#4243] Tweaks to the new var-dumper component
javiereguiluz
pushed a commit
to javiereguiluz/symfony-docs
that referenced
this pull request
Jun 22, 2015
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.