public function createRelative($uri = null)
    {
        if (empty($uri)) {
            // Empty uri means baseurl
            return $this->baseUrl;
        } elseif (substr($uri, 0, 7) == "http://"
            || substr($uri, 0, 8) == "https://"
            || substr($uri, 0, 2) == "//"
        ) {
            // Fully qualified, just leave as is.
            return rtrim($uri, '/');
        } elseif ($uri[0] == '/') {
            // Absolute url, prepend with siteUrl
            return rtrim($this->siteUrl . rtrim($uri, '/'), '/');
        }

        $uri = rtrim($uri, '/');
        return $this->baseUrl . '/' . $uri;
    }
public function createRelative($uri = null)
    {
        if (empty($uri)) {
            // Empty uri means baseurl
            return $this->baseUrl;
        } elseif (substr($uri, 0, 7) == "http://"
            || substr($uri, 0, 8) == "https://"
            || substr($uri, 0, 2) == "//"
        ) {
            // Fully qualified, just leave as is.
            return rtrim($uri, '/');
        } elseif ($uri[0] == '/') {
            // Absolute url, prepend with siteUrl
            return rtrim($this->siteUrl . rtrim($uri, '/'), '/');
        }

        $uri = rtrim($uri, '/');
        return $this->baseUrl . '/' . $uri;
    }
public function createRelative ( $ uri = null ) { if ( empty ( $ uri ) ) { // Empty uri means baseurl return $ this -> baseUrl ; } elseif ( substr ( $ uri , 0 , 7 ) == "http://" || substr ( $ uri , 0 , 8 ) == "https://" || substr ( $ uri , 0 , 2 ) == "//" ) { // Fully qualified, just leave as is. return rtrim ( $ uri , '/' ) ; } elseif ( $ uri [ 0 ] == '/' ) { // Absolute url, prepend with siteUrl return rtrim ( $ this -> siteUrl . rtrim ( $ uri , '/' ) , '/' ) ; } $ uri = rtrim ( $ uri , '/' ) ; return $ this -> baseUrl . '/' . $ uri ; }
Create an url and prepend the baseUrl to the directory of
the frontcontroller.

@param string $uri part of uri to use when creating an url.
"" or null means baseurl to directory of
the current frontcontroller.

@return string as resulting url.
Create an url and prepend the baseUrl to the directory of the frontcontroller .