Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

added documentation for the new absolute_url() and relative_path() Twig functions#4805

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
weaverryan merged 1 commit intosymfony:masterfromfabpot:twig-functions
Jan 25, 2015

Conversation

fabpot
Copy link
Member

QA
Doc fix?no
New docs?symfony/symfony#13264
Applies to2.7
Fixed ticketsn/a

fabpot added a commit to symfony/symfony that referenced this pull requestJan 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#4805While 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@TobionCommits-------0ec852d added a relative_path Twig functionee27ed8 added an absolute_url() Twig function
fabpot added a commit to symfony/twig-bridge that referenced this pull requestJan 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#4805While 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@TobionCommits-------0ec852d added a relative_path Twig functionee27ed8 added an absolute_url() Twig function
fabpot added a commit to symfony/twig-bundle that referenced this pull requestJan 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#4805While 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@TobionCommits-------0ec852d added a relative_path Twig functionee27ed8 added an absolute_url() Twig function
fabpot added a commit to symfony/http-foundation that referenced this pull requestJan 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#4805While 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@TobionCommits-------0ec852d added a relative_path Twig functionee27ed8 added an absolute_url() Twig function
@xabbuh
Copy link
Member

👍

1 similar comment
@wouterj
Copy link
Member

👍


Returns a relative path for the given absolute path (based on the current
request path). For instance, if the current path is
``/article/news/welcome.html``, the relative path for path

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

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``.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I would remove the second "path" completely: "the relative path for/article/image.png is../images.png"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

fixed now

@wouterj
Copy link
Member

👍 again, it's ready!

@weaverryanweaverryan merged commite4d22f0 intosymfony:masterJan 25, 2015
weaverryan added a commit that referenced this pull requestJan 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/aCommits-------e4d22f0 added documentation for the new absolute_url() and relative_path() Twig functions
@weaverryan
Copy link
Member

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 requestJan 25, 2015
weaverryan added a commit that referenced this pull requestJan 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 commandConflicts:reference/twig_reference.rst
wouterj added a commit that referenced this pull requestFeb 14, 2015
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes#4977).Discussion----------Unnecessary commaCommits-------8a2f0ba Wrong comma81e8c13 Merge branch '2.7'ef39a01 Remove diff8d56ad7 Merge branch '2.7'6fd286b Added January changelogad97700 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 functions907ee0d 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 markup032a6b4 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.56ef6a04 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 component09a6fd7 [Form] Add entity manager instance support for em option265604b [#4243] Tweaks to the new var-dumper component
javiereguiluz pushed a commit to javiereguiluz/symfony-docs that referenced this pull requestJun 22, 2015
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@fabpot@xabbuh@wouterj@weaverryan@javiereguiluz

[8]ページ先頭

©2009-2025 Movatter.jp