diff --git a/user_guide_src/source/helpers/url_helper.rst b/user_guide_src/source/helpers/url_helper.rst index eec0c7067d54..6dcd67ae9994 100644 --- a/user_guide_src/source/helpers/url_helper.rst +++ b/user_guide_src/source/helpers/url_helper.rst @@ -20,9 +20,9 @@ The following functions are available: .. php:function:: site_url([$uri = ''[, $protocol = null[, $altConfig = null]]]) - :param array|string $uri: URI string or array of URI segments - :param string $protocol: Protocol, e.g., 'http' or 'https' - :param \\Config\\App $altConfig: Alternate configuration to use + :param array|string $uri: URI string or array of URI segments. + :param string $protocol: Protocol, e.g., 'http' or 'https'. If empty string '' is set, a protocol-relative link is returned. + :param \\Config\\App $altConfig: Alternate configuration to use. :returns: Site URL :rtype: string @@ -56,8 +56,8 @@ The following functions are available: .. php:function:: base_url([$uri = ''[, $protocol = null]]) - :param array|string $uri: URI string or array of URI segments - :param string $protocol: Protocol, e.g., 'http' or 'https' + :param array|string $uri: URI string or array of URI segments. + :param string $protocol: Protocol, e.g., 'http' or 'https'. If empty string '' is set, a protocol-relative link is returned. :returns: Base URL :rtype: string @@ -83,6 +83,11 @@ The following functions are available: The above example would return something like: **http://example.com/blog/post/123** + If you pass an empty string ``''`` as the second parameter, it returns + the protocol-relative link: + + .. literalinclude:: url_helper/026.php + This is useful because unlike :php:func:`site_url()`, you can supply a string to a file, such as an image or stylesheet. For example: diff --git a/user_guide_src/source/helpers/url_helper/004.php b/user_guide_src/source/helpers/url_helper/004.php index e820085b3c59..8bc5192b803e 100644 --- a/user_guide_src/source/helpers/url_helper/004.php +++ b/user_guide_src/source/helpers/url_helper/004.php @@ -1,3 +1,4 @@