.TH "Eliom_content.Xhtml.F" 3o 2012-06-11 OCamldoc ""
.SH NAME
Eliom_content.Xhtml.F \- Creation of functional HTML5 content (copy-able but not referable).
.SH Module
Module Eliom_content.Xhtml.F
.SH Documentation
.sp
Module
.BI "F"
:
.B sig end
.sp
Creation of functional HTML5 content (copy\-able but not referable)\&.
.sp
.sp
.sp
.sp
.I include Eliom_content_core.Xhtml.F
.sp
.B Content creation
See
.sp
.sp
.PP
.B ===
.B Forms creation
.B ===
.PP
.PP
.B ===
.B Links and forms
.B ===
.PP
.I val make_uri
:
.B ?absolute:bool ->
.B ?absolute_path:bool ->
.B ?https:bool ->
.B service:('a, unit, [< Eliom_service.get_service_kind ],
.B [< Eliom_service.suff ], 'b, unit, [< Eliom_service.registrable ],
.B 'c)
.B Eliom_service.service ->
.B ?hostname:string ->
.B ?port:int ->
.B ?fragment:string ->
.B ?keep_nl_params:[ `All | `None | `Persistent ] ->
.B ?nl_params:Eliom_parameter.nl_params_set -> 'a -> Eliom_content_core.Xml.uri
.sp
The function
.B make_uri service get_params
returns the URL of the
service
.B service
applied to the GET parameters
.B 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:
.sp
.sp
\-the optional parameter
.B ~absolute_path
is
.B true
\&.
.sp
\-the optional parameter
.B ~absolute
is
.B true
\&.
.sp
\-the optional parameter
.B ~https
is
.B true
(resp\&.
.B false
)
and the current request protocol is
.B http
(resp\&.
.B https
)\&.
.sp
\-the optional parameter
.B ~https
is
.B true
and the
function is used outside of a service handler
.sp
\-the
.B service
has been created with
.B ~https:true
and the
current request protocol is
.B http
\&.
.sp
\-the
.B service
has been created with
.B ~https:true
and the
function is used outside of a service handler\&.
When only the first condition is met (
.B ~absolute_path
is
.B true
)
the returned URL is just the absolute path, but when any other
condition is satisfied the returned URL is prefixed with
.B protocol://hostname[:port]
, where:
.sp
.sp
\-
.B protocol
is:
.sp
\-
.B https
if the
.B service
has been created with
.B ~https:true
or the optional parameter
.B ~https
is
.B true
;
.sp
\-
.B http
if the optional parameter
.B ~https
is
.B false
;
.sp
\-the current request protocol if available;
.sp
\-
.B http
in any other case\&.
.sp
\-
.B hostname
is:
.sp
\-the optional parameter
.B ~hostname
if given;
.sp
\-the attribute
.B defaulthostname
of
.B
tag in
configuration file or the machine hostname
if the option
.B
is set;
.sp
\-the
.B Host
http header of the current request if available;
.sp
\-the attribute
.B defaulthostname
of
.B
tag in
configuration file or the machine hostname in any other case\&.
7 \-
.B port
is:
.sp
\-the optional parameter
.B ~port
if given;
.sp
\-the attribute
.B defaulthttpsport
(resp\&.
.B defaulthttpport
) of
.B
tag
in configuration file or
.B 443
(resp\&. 80) if
.B protocol
is
.B https
(resp\&.
.B http
) and
the current request protocol is
.B http
(resp\&.
.B https
);
.sp
\-the attribute
.B defaulthttpsport
(resp\&.
.B defaulthttpsport
) of
.B
tag
in configuration file or
.B 443
(resp\&. 80) if the option
.B
is set and
.B protocol
is
.B https
(resp\&.
.B http
);
.sp
\-the port associated to the
.B Host
http header of the current
request if available;
.sp
\-the incoming port of the current request if available;
.sp
\-the attribute
.B defaulthttpport
(resp\&.
.B defaulthttpsport
) of
.B
tag
in configuration file or
.B 80
(resp\&.
.B 443
) in any other case\&.
If given the optional parameter
.B ~fragment
is prefixed by
.B #
and appended to the URL\&.
.sp
The optional parameter
.B keep_nl_params
allows one to override the
.B keep_nl_params
parameter used when creating the
.B service
, see
.B Eliom_service\&.service
for a detailled description\&.
.sp
The optional parameter
.B nl_params
allows one to add non localized
GET parameter to the URL\&. See the eliom manual for more
information about \&.
.sp
.sp
.I val make_string_uri
:
.B ?absolute:bool ->
.B ?absolute_path:bool ->
.B ?https:bool ->
.B service:('a, unit, [< Eliom_service.get_service_kind ],
.B [< Eliom_service.suff ], 'b, unit, [< Eliom_service.registrable ],
.B 'c)
.B Eliom_service.service ->
.B ?hostname:string ->
.B ?port:int ->
.B ?fragment:string ->
.B ?keep_nl_params:[ `All | `None | `Persistent ] ->
.B ?nl_params:Eliom_parameter.nl_params_set -> 'a -> string
.sp
The function
.B make_string_uri service get_params
returns the URL of the
of the service
.B service
applied to the GET parameters
.B get_params
\&. See
.B Eliom_content\&.Xhtml\&.F\&.make_uri
for a detailled
description of optional parameters\&.
.sp
The function
.B make_string_uri
is an alias of
.B Eliom_uri\&.make_string_uri
\&.
.sp
Warning: The function
.B make_string_uri
should not be called outside
of a service handler, unless one of the following condition is met:
.sp
.sp
\-the optional parameter
.B ~absolute_path
is
.B true
\&.
.sp
\-the optional parameter
.B ~absolute
is
.B true
\&.
.sp
\-the optional parameter
.B ~https
is
.B true
\&.
.sp
\-the
.B service
has been created with
.B ~https:true
\&.
.sp
\-the
.B service
is an external service\&.
.sp
.sp
.I val uri_of_string
:
.B (unit -> string) -> Eliom_content_core.Xml.uri
.sp
The function
.B uri_of_string f
returns a URI whose content is
equivalent to
.B f ()
\&.
.sp
For XML tree build with TyXML, like
.B Eliom_content\&.Html5
,
.B Eliom_content\&.Xhtml
or
.B Svg\&.F
, the function
.B 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\&.
.sp
For other module, the function
.B f
is immediatly applied\&.
.sp
.sp
.I val make_uri_components
:
.B ?absolute:bool ->
.B ?absolute_path:bool ->
.B ?https:bool ->
.B service:('a, unit, [< Eliom_service.get_service_kind ],
.B [< Eliom_service.suff ], 'b, unit, [< Eliom_service.registrable ],
.B 'c)
.B Eliom_service.service ->
.B ?hostname:string ->
.B ?port:int ->
.B ?fragment:string ->
.B ?keep_nl_params:[ `All | `None | `Persistent ] ->
.B ?nl_params:Eliom_parameter.nl_params_set ->
.B 'a -> string * (string * string) list * string option
.sp
The function
.B make_uri_components service get_params
returns the
a triplet
.B (path, get_params, fragment)
that is a decomposition
of the URL for the service
.B service
applied to the GET parameters
.B get_params
\&. By default the returned
.B path
is relative to the
current request URL but it could be absolute URL in some
situation, see
.B Eliom_content\&.Xhtml\&.F\&.make_uri
for more information and a description
of optional parameters\&.
.sp
The function
.B make_uri_components
is an alias for
.B Eliom_uri\&.make_uri_components
\&.
.sp
Warning: depending on the optional parameters, the function
.B make_uri_components
may not be used outside of a service
handler\&. See
.B Eliom_content\&.Xhtml\&.F\&.make_string_uri
for a detailled description\&.
.sp
.sp
.I val make_post_uri_components
:
.B ?absolute:bool ->
.B ?absolute_path:bool ->
.B ?https:bool ->
.B service:('a, 'b, [< Eliom_service.post_service_kind ],
.B [< Eliom_service.suff ], 'c, 'd, [< Eliom_service.registrable ], 'e)
.B Eliom_service.service ->
.B ?hostname:string ->
.B ?port:int ->
.B ?fragment:string ->
.B ?keep_nl_params:[ `All | `None | `Persistent ] ->
.B ?nl_params:Eliom_parameter.nl_params_set ->
.B ?keep_get_na_params:bool ->
.B 'a ->
.B 'b ->
.B string * (string * string) list * string option * (string * string) list
.sp
Same a
.B Eliom_content\&.Xhtml\&.F\&.make_uri_components
, but also returns a list of post
parameters\&.
.sp
.sp
.I val a
:
.B ?absolute:bool ->
.B ?absolute_path:bool ->
.B ?https:bool ->
.B ?a:Xhtml_types.a_attrib Eliom_content_core.Xhtml.F.attrib list ->
.B service:('a, unit, [< Eliom_service.get_service_kind ],
.B [< Eliom_service.suff ], 'b, unit, [< Eliom_service.registrable ],
.B 'c)
.B Eliom_service.service ->
.B ?hostname:string ->
.B ?port:int ->
.B ?fragment:string ->
.B ?keep_nl_params:[ `All | `None | `Persistent ] ->
.B ?nl_params:Eliom_parameter.nl_params_set ->
.B ?xhr:bool ->
.B Xhtml_types.a_content Eliom_content_core.Xhtml.F.elt list ->
.B 'a -> [> Xhtml_types.a ] Eliom_content_core.Xhtml.F.elt
.sp
The function
.B a service a_content get_params
creates a
.B
node that link to
.B service
applied to GET parameters
.B get_params
and whose content is
.B a_content
\&. By default, the
.B href
attribute
is a relative URL recomputed at each request with
.B Eliom_content\&.Xhtml\&.F\&.make_uri
\&.
.sp
By default, the link is realized such that the client\-side Eliom application
keeps running irrespectable of the usage of the link (cf\&. )\&.
.sp
By contrast, if the optional parameter
.B ~xhr:false
is given, the link is
realized as a standard HTML link and clicking it discontinues the Eliom
application\&.
The
.B ~xhr
parameter has no effect outside an Eliom application\&.
.sp
NB that the default value of
.B ~xhr
is configurable through <>
.sp
The optional parameter
.B ~a
allows one to add extra HTML attributes to
the generated node\&.
.sp
See
.B Eliom_content\&.Xhtml\&.F\&.make_uri
for description of other optional parameters\&.
.sp
.sp
.I val css_link
:
.B ?a:Xhtml_types.link_attrib Eliom_content_core.Xhtml.F.attrib list ->
.B uri:Eliom_content_core.Xml.uri ->
.B unit -> [> Xhtml_types.link ] Eliom_content_core.Xhtml.F.elt
.sp
The function
.B css_link ~uri ()
creates a
.B
node that
reference a Cascading StyleSheet (CSS)\&.
.sp
If the CSS is generated by an Eliom service, use
.B Eliom_content\&.Xhtml\&.F\&.make_uri
to
calculate the service URI\&. If the CSS is a static file, you may
also use
.B Eliom_service\&.static_dir
or
.B Eliom_service\&.external_service
to abstract the file with a
service\&.
.sp
The optional parameter
.B ~a
allows one to add extra HTML attributes to
the generated node\&.
.sp
.sp
.I val js_script
:
.B ?a:Xhtml_types.script_attrib Eliom_content_core.Xhtml.F.attrib list ->
.B uri:Eliom_content_core.Xml.uri ->
.B unit -> [> Xhtml_types.script ] Eliom_content_core.Xhtml.F.elt
.sp
The function
.B js_script ~uri ()
creates a
.B