Categories

ep.uriSegment()

Categories: Utilities

ep.uriSegment( uri )

Plugin: ep.uri

Description: Segment a uri string.

  • ep.uriSegment( uri )

    version added: 6.11.0

    uri   A uri string.

The ep.uriSegment() method segment a uri in some parts.

Parts:

  • href The full uri.
  • protocol The protocol http or https.
  • host The host name for example www.epages.com
  • path The dir path. /path/example.html
  • query The get parameters. ?foo=bar&data=more
  • anchor Anchor id. #id
  • parameters The query data as object. {foo:"bar", data:"more"}
  • Segment a uri.

    Code:
    ep.uriSegment('http://www.epages.com/de/images/example.jpg?size=xl#center');
    
    Results:
    {
        "href": "http://www.epages.com/de/images/example.jpg?size=xl#center",
        "protocol": "http",
        "host": "www.epages.com",
        "path": "de/images/example.jpg",
        "query": "?size=xl",
        "anchor": "#center",
        "parameters": {
            "size": "xl"
        }
    }
    
    

ep.uriSegment( uri )

Plugin: ep.uri

Description: Join uri parts.

  • ep.uriSegment( uri )

    version added: 6.11.0

    parts   A key/value map of uir parts.

The ep.uriSegment() method join part of a uir to a uri string.

Parts:

  • protocol The protocol http or https.
  • host The host name for example www.epages.com
  • path The dir path. /path/example.html
  • query The get parameters. ?foo=bar&data=more
  • anchor Anchor id. #id
  • parameters The query data as object. {foo:"bar", data:"more"}
  • Join uri parts.

    Code:
    ep.uriSegment({
        "protocol": "http",
        "host": "www.epages.com",
        "path": "de/images/example.jpg",
        "anchor": "#center",
        "parameters": {
            "size": "xl"
        }
    });
    
    Results:
    http://www.epages.com/de/images/example.jpg?size=xl#center