[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Modcaml] How to use ::table(name):: - ::end::
From: |
Stephany Francois |
Subject: |
[Modcaml] How to use ::table(name):: - ::end:: |
Date: |
Sat, 23 Jul 2005 17:47:33 +0200 |
Hi,
I'm discovering the mod_caml and trying to do some little web apps.
I try to use tables but I don't manage to get what I want.
I'd like to have a table with Title of books and their authors. You can
add a Books with a form.
Here's the code i produce (it's very inspired with the params exemple)
../...
let temp = " <html> <head> ::titre_html:: </head> <body>
<h1>::titre2_html::</h1> <br>
<table>
<tr><th> Titre </th> <th> Auteur </th> </tr>
::table(parametres)::
<tr><td> ::titre_html:: </td> <td> ::auteur_html:: </td> </tr>
::end::
</table>
<h2>Ajouter un livre</h2><br>
<form method=\"post\" action=\"essai2.cmo\">
Titre: <input name=\"titre\" value=\"Entrez le titre ici\"> <br>
Auteur: <input name=\"auteur\" value=\"Entrez l'auteur ici\"> <br>
<input type=\"submit\" value=\"Ajouter\"
</form> </body> </html>"
let temp = Template.template_from_string temp ;;
temp#set "titre" "Bibliothèque";;
temp#set "titre2" "Biblio";;
let run a =
let q = new cgi a in
let list_of_param = q#params in
let ta = List.map (fun (titre, auteur) -> ["titre" ,
Template.VarString titre; "auteur" , Template.VarString auteur ] )
list_of_param in
temp#table "parametres" ta;
.../...
I'd like to obtain the following html code:
<tr><th> Titre </th> <th> Auteur </th> </tr>
<tr> <td>Essais</td> <td> Freud </td> <tr>
But, my scripts gives:
<table>
<tr><th> Titre </th> <th> Auteur </th> </tr>
<tr><td> titre </td> <td> Essais </td> </tr>
<tr><td> auteur </td> <td> Freud </td> </tr>
</table>
It seems to return the name ("titre" or "auteur") of the parameters ans
its value ("Essais" or "Freud").
How to ignore the name of the parameters? I have the impressions that
the params.cmo example has the same problem: the table isn't very
logic...
I know that It's possible to do that with an other method but i'd like
to use the ::table::
Thanks for your precisions
Francois
- [Modcaml] How to use ::table(name):: - ::end::,
Stephany Francois <=