Skip to content

url_for() #101

Description

@splitbrain

So, I realize that this has been discussed before in #20 and also in slimphp/Slim#1326, but it seem this has not really been resolved.

Let me explain the problem again

  1. Sometimes I need a fully qualified URL to a named route. Simplest example: I'm using twig to build the email body for an account activation mail. Let's say I have a route named activate with a parameter token
  2. My application runs in a sub directory of the web server. Let's say /app

So here are my options:

  1. {{ path_for('activation', {token: 'foo'}) }} -> /app/activation/foo
  2. {{ base_url() }} -> http://example.com/app

As you can see, I can not simply combine the two to create an absolute URL, since the initial directory would be duplicated. Ideally I would have a url_for() method that works exactly like path_for but returns a fully qualified URL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions