This is server API (go to client)

Module Eliom_tools

module Eliom_tools : sig..end

Helpers for (hierarchical) menu generation in HTML5. See the Eliom manual for more information about menu or hierarchical site.


Helpers for (hierarchical) menu generation in HTML5. See the Eliom manual for more information about menu or hierarchical site.

type 
  ([< Eliom_service.service_method ], [< Eliom_service.registrable ]
   , [< Eliom_registration.non_ocaml_service ])
one_page =
  (unit, unit, [< Eliom_service.service_method ] as 'a,
   Eliom_service.attached, Eliom_service.service_kind,
   [ `WithoutSuffix ], unit, unit, [< Eliom_service.registrable ] as 'b,
   [< Eliom_registration.non_ocaml_service ] as 'c)
  Eliom_service.service

Restriction of Eliom_service.​service to services without parameters that do not returns a marshalled OCaml value.

type 
  ([< Eliom_service.service_method ], [< Eliom_service.registrable ], 'c)
hierarchical_site =
  ([< Eliom_service.service_method ] as 'a,
   [< Eliom_service.registrable ] as 'b)
  main_page *
  ('c * ('a, 'b, 'c) hierarchical_site_item) list

Hierarchical sites description. This is is a pair (main page, subpages list). Each subpage is defined by the text to be displayed in menus and a Eliom_tools.​hierarchical_site_item.

type ([< Eliom_service.service_method ], [< Eliom_service.registrable ]) main_page =  | Main_page of 
    ([< Eliom_service.service_method ] as 'a,
     [< Eliom_service.registrable ] as 'b,
     Eliom_registration.non_ocaml_service)
    one_page
 | Default_page of
    ('a, 'b, Eliom_registration.non_ocaml_service)
    one_page
 | Not_clickable(* <<div class="odocwiki_info"|~When you do not want the menu entry to be a link but you want subpages~. >> *)
type 
  ([< Eliom_service.service_method ], [< Eliom_service.registrable ], 'c)
hierarchical_site_item =  | Disabled | Site_tree of
    ([< Eliom_service.service_method ] as 'a,
     [< Eliom_service.registrable ] as 'b, 'c)
    hierarchical_site
(* <<div class="odocwiki_info"|~The menu entry as a label and subsections~. >> *)
module type HTML5_TOOLS = sig..end
module F : HTML5_TOOLS

Menus with functional node semantics

module D : HTML5_TOOLS

Menus with DOM semantics

val with_js_file : string list -> unit

Record an (external) JavaScript file to be included in Eliom_tools.F.html.

val with_css_file : string list -> unit

Record an CSS file to be included in Eliom_tools.F.html.

Other tools

val wrap_handler : 
  (unit -> 'a option Lwt.t) ->
  ('get -> 'post -> 'res Lwt.t) ->
  ('a -> 'get -> 'post -> 'res Lwt.t) -> 'get -> 'post -> 'res Lwt.t

This function allows one to wrap a service handler easily depending on whether certain information is available or not.

The first arguments provides that information (Some value) of not (None), the second argument is called just with two arguments when the information is not available (the two arguments are suggesting GET and POST parameters of a request). The third argument is called with that information if available and the parameters.

let user_eref = Eliom_reference.eref ~scope None
    let anonymous_handler _ _ =
      Lwt.return (html (head (title "not allowed")) (body []))
    let authenticated_handler f =
      Eliom_tools.wrap_handler
        (fun () -> Eliom_reference.get user_eref)
        anonymous_handler f
    let guarded_service =
      My_app.register_service ~path ~get_param
        (authenticated_handler
           (fun user get () ->
              Lwt.return (html (head (title ("hello "^user))) (body []))))

Record an (external) JavaScript file to be included in Eliom_tools.F.html.

Record an CSS file to be included in Eliom_tools.F.html.