package eliom
Install
Dune Dependency
Authors
Maintainers
Sources
md5=218bcb5cd275cc05be06574c5fa357fa
sha512=edbf8b084ec1b7439d4715199c22eb925a77a2dcfbe76bb5bbc4b9d076b70be1b0de74f9eab9dfb7854df28d65eb31a4c17380528d4a461d9c2a4222abe804cc
doc/eliom.server/Eliom_form/Make_links/index.html
Module Eliom_form.Make_links
Source
Parameters
Signature
val make_uri :
?absolute:bool ->
?absolute_path:bool ->
?https:bool ->
service:
('get, unit, Eliom_service.get, _, _, _, _, _, _, unit, _) Eliom_service.t ->
?hostname:string ->
?port:int ->
?fragment:string ->
?keep_nl_params:[ `All | `Persistent | `None ] ->
?nl_params:Eliom_parameter.nl_params_set ->
'get ->
H.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
istrue
. - the optional parameter
~absolute
istrue
. - the optional parameter
~https
istrue
(resp.false
) and the current request protocol ishttp
(resp.https
). - the optional parameter
~https
istrue
and the function is used outside of a service handler - the
service
has been created with~https:true
and the current request protocol ishttp
. - 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 theservice
has been created with~https:true
or the optional parameter~https
istrue
;http
if the optional parameter~https
isfalse
;- 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.
- the optional parameter
port
is:- the optional parameter
~port
if given; - the attribute
defaulthttpsport
(resp.defaulthttpport
) of<host>
tag in configuration file or443
(resp. 80) ifprotocol
ishttps
(resp.http
) and the current request protocol ishttp
(resp.https
); - the attribute
defaulthttpsport
(resp.defaulthttpsport
) of<host>
tag in configuration file or443
(resp. 80) if the option<usedefaulthostname/>
is set andprotocol
ishttps
(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 or80
(resp.443
) in any other case.
- the optional parameter
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 <<a_manual chapter="server-params"
fragment="nonlocalizedparameters"|non localized
parameters>>
.
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.
val css_link :
?a:[< Html_types.link_attrib ] H.attrib list ->
uri:H.uri ->
unit ->
[> Html_types.link ] H.elt
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 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 ] H.attrib list ->
uri:H.uri ->
unit ->
[> Html_types.script ] H.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 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 ] H.attrib list ->
service:
('get,
unit,
Eliom_service.get,
_,
_,
_,
_,
_,
_,
unit,
Eliom_service.non_ocaml)
Eliom_service.t ->
?hostname:string ->
?port:int ->
?fragment:string ->
?keep_nl_params:[ `All | `Persistent | `None ] ->
?nl_params:Eliom_parameter.nl_params_set ->
?xhr:bool ->
'a H.elt list ->
'get ->
[> 'a Html_types.a ] H.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 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. <<a_api project="eliom"
subproject="client" | val 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 <<a_api project="eliom" subproject="server" | val
Eliom_config.set_default_links_xhr >>
.
The optional parameter ~a
allows one to add extra HTML attributes to the generated node.
See make_uri
for description of other optional parameters.
To create a <a>
node that is not associated to a service, use Raw.a
.