-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script type="ml/global"> | ||
type Async.session_data += Count of int | ||
</script> | ||
<script type="ml/prelude"> | ||
let cookies, session = Session.check ~init:(fun _ -> Count 0) request | ||
let count = | ||
match Session.get_session_data session with | ||
| Count n -> n | ||
| _ -> -12 | ||
| exception Not_found -> -100 | ||
let _ = Session.set_session_data session (Count (count+1)) | ||
</script> | ||
</head> | ||
<body> | ||
<h1>dynamic hello!</h1> | ||
<ul> | ||
<li> item 1 </li> | ||
<li> item 2 </li> | ||
<li> item 3 </li> | ||
<li> item 4 </li> | ||
<li> views: <ML> | ||
let _ = echo (string_of_int count);; | ||
let _ = echo (if count mod 2 = 0 then | ||
<p>even (<ML> ^ string_of_int count ^ </ML>)</p> | ||
else <p>odd</p>) | ||
</ML> | ||
</li> | ||
</ul> | ||
<a href="."> escape from this file </a> | ||
<br/> | ||
request: <ML> | ||
let _ = printf "%a" Request.pp request | ||
</ML> | ||
</body> | ||
</html> |