diff --git a/tutos/dev/manual/basics.wiki b/tutos/dev/manual/basics.wiki index 4912a42b..3765508c 100644 --- a/tutos/dev/manual/basics.wiki +++ b/tutos/dev/manual/basics.wiki @@ -539,9 +539,21 @@ Same for {{{module%shared}}}, {{{open%shared}}}, {{{type%shared}}} etc. @@class="centered"@@{{@@class="img-col-width-400"@@files/tutorial/client-server.svg|Client-server build system}} ===Client values=== -Client values can be declared within server or shared code as - {{{[%client[ ( : ) ]}}}. -The type annotation is almost always required. +Fragments of client code can be included in server (or shared) sections. + +Example: + +< ... ]] [ ... ] +>> + +The syntax is {{{[%client ( : ) }}}. +Type annotation is almost always required. + +These client fragments can be manipulated as server side OCaml values: +<> If such section is reached while generating a page on server side, the client-side code will be executed once the page is displayed. @@ -556,14 +568,13 @@ If such section is reached during module initialization on the server (global client section), it will be executed on client side everytime a new client side program is launched. - The tutorial [[tutowidgets|Client-Server Widgets]] shows how client values can be manipulated -on client side. +on server side. ===Injections=== -Server side variables can be accessed (injected) in client code by prefixing +Server side values can be injected in client code by prefixing them with {{{~%}}} as in this example: <> The value will automatically be sent with the page by Eliom. +It is possible to combine injections and client-values: +<> +<> + +<
> + ===Example=== This section shows a typical example of client-server code: call a function when user clicks on a page element.