Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Module type Eliom_form_sigs.LINKS

module type LINKS = sig..end

type +'a elt
type +'a attrib
type uri
val make_uri : 
  ?absolute:bool ->
  ?absolute_path:bool ->
  ?https:bool ->
  service:('get, unit, Eliom_service.get, 'a, 'b, 'c, 'd,
   [< `WithSuffix | `WithoutSuffix ], 'e, unit, 'f)
   Eliom_service.t ->
  ?hostname:string ->
  ?port:int ->
  ?fragment:string ->
  ?keep_nl_params:[ `All | `None | `Persistent ] ->
  ?nl_params:Eliom_parameter.nl_params_set ->
  'get -> uri

The function make_uri service get_params returns the URL of the service service applied to the GET parameters get_params. By default the returned URL is relative to the current request URL but it is absolute when one of the following conditions is met:

  • the optional parameter ~absolute_path is true.
  • the optional parameter ~absolute is true.
  • the optional parameter ~https is true (resp. false) and the current request protocol is http (resp. https).
  • the optional parameter ~https is true and the function is used outside of a service handler
  • the service has been created with ~https:true and the current request protocol is http.
  • the service has been created with ~https:true and the function is used outside of a service handler.

When only the first condition is met (~absolute_path is true) the returned URL is just the absolute path, but when any other condition is satisfied the returned URL is prefixed with protocol://hostname[:port], where:

  • protocol is:
    • https if the service has been created with ~https:true or the optional parameter ~https is true;
    • http if the optional parameter ~https is false;
    • the current request protocol if available;
    • http in any other case.
  • hostname is:
    • the optional parameter ~hostname if given;
    • the attribute defaulthostname of <host> tag in configuration file or the machine hostname if the option <usedefaulthostname/> is set;
    • the Host http header of the current request if available;
    • the attribute defaulthostname of <host> tag in configuration file or the machine hostname in any other case.
  • port is:
    • the optional parameter ~port if given;
    • the attribute defaulthttpsport (resp. defaulthttpport) of <host> tag in configuration file or 443 (resp. 80) if protocol is https (resp. http) and the current request protocol is http (resp. https);
    • the attribute defaulthttpsport (resp. defaulthttpsport) of <host> tag in configuration file or 443 (resp. 80) if the option <usedefaulthostname/> is set and protocol is https (resp. http);
    • the port associated to the Host http header of the current request if available;
    • the incoming port of the current request if available;
    • the attribute defaulthttpport (resp. defaulthttpsport) of <host> tag in configuration file or 80 (resp. 443) in any other case.

If given the optional parameter ~fragment is prefixed by # and appended to the URL.

The optional parameter keep_nl_params allows one to override the keep_nl_params parameter used when creating the service, see Eliom_service.create for a detailed description.

The optional parameter nl_params allows one to add non localized GET parameter to the URL. See the eliom manual for more information about non localized parameters.

val uri_of_string : (unit -> string) -> uri

The function uri_of_string f returns a URI whose content is equivalent to f ().

For XML tree build with TyXML, like Html or Svg.F, the function f is applied each time the XML tree is sent to the client (either as page content or as a marshalled OCaml value). Hence, the function is always evaluated in the context of a service handler.

For other module, the function f is immediately applied.

The function css_link ~uri () creates a <link> node that reference a Cascading StyleSheet (CSS).

If the CSS is generated by an Eliom service, use Eliom_form_sigs.LINKS.make_uri to calculate the service URI. If the CSS is a static file, you may also use Eliom_service.static_dir or Eliom_service.extern to abstract the file with a service.

The optional parameter ~a allows one to add extra HTML attributes to the generated node.

val js_script : 
  ?a:[< Html_types.script_attrib ] attrib list ->
  uri:uri ->
  unit -> [> Html_types.script ] elt

The function js_script ~uri () creates a <script> node that reference a javascript file.

If the script content is generated by an Eliom service, use Eliom_form_sigs.LINKS.make_uri to calculate the service URI. If it is a static file, you may also use Eliom_service.static_dir or Eliom_service.extern to abstract the file with a service.

The optional parameter ~a allows one to add extra HTML attributes to the generated node.

val a : 
  ?absolute:bool ->
  ?absolute_path:bool ->
  ?https:bool ->
  ?a:[< Html_types.a_attrib ] attrib list ->
  service:('get, unit, Eliom_service.get, 'b, 'c, 'd, 'e,
   [< `WithSuffix | `WithoutSuffix ], 'f, unit,
   Eliom_service.non_ocaml)
   Eliom_service.t ->
  ?hostname:string ->
  ?port:int ->
  ?fragment:string ->
  ?keep_nl_params:[ `All | `None | `Persistent ] ->
  ?nl_params:Eliom_parameter.nl_params_set ->
  ?xhr:bool ->
  'a elt list ->
  'get -> [> 'a Html_types.a ] elt

The function a service a_content get_params creates a <a> node that link to service applied to GET parameters get_params and whose content is a_content. By default, the href attribute is a relative URL recomputed at each request with Eliom_form_sigs.LINKS.make_uri.

By default, the link is implemented in a way that allows the client-side Eliom application to keep running, irrespectable of the usage of the link (cf. Eliom_client.change_page ).

By contrast, if the optional parameter ~xhr:false is given, the link is realized as a standard HTML link and clicking it discontinues the Eliom application. The ~xhr parameter has no effect outside an Eliom application. The default value of ~xhr is configurable through Eliom_config.set_default_links_xhr .

The optional parameter ~a allows one to add extra HTML attributes to the generated node.

See Eliom_form_sigs.LINKS.make_uri for description of other optional parameters.

To create a <a> node that is not associated to a service, use Raw.a.