Uses PHP's parse_url
to return specified pieces of a given URL.
- Move the
statamic-ParseURL
folder tosite/addons/ParseUrl
, in CamelCase, not capital letters (removing thestatamic-
bit) cd
into your site's directory.- Run
php please addons:refresh
In your template, call the modifier like this:
{{ current_url | parse_url:[option] }}
… where [option]
is one of:
scheme
user
pass
host
port
path
query
fragment
From the php docs on parse_url
If given the URL:
http://username:password@hostname:9090/path?arg=value#anchor
… then …
scheme
== "http"user
== "username"pass
== "password"host
== "hostname"port
== 9090path
== "/path"query
== "arg=value"fragment
== "anchor"