mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
.Skylark tutorial
git-svn-id: svn://ultimatepp.org/upp/trunk@5141 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
85e3814e3f
commit
81e10147be
4 changed files with 72 additions and 0 deletions
13
tutorial/Skylark07/Skylark07.upp
Normal file
13
tutorial/Skylark07/Skylark07.upp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
description "Session\377";
|
||||
|
||||
uses
|
||||
Core,
|
||||
Skylark;
|
||||
|
||||
file
|
||||
index.witz,
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "SSE2 MT";
|
||||
|
||||
15
tutorial/Skylark07/index.witz
Normal file
15
tutorial/Skylark07/index.witz
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<html>
|
||||
<body>
|
||||
<form action=$Submit method="post" accept-charset="utf-8" enctype="multipart/form-data">
|
||||
<P>
|
||||
$post_identity()
|
||||
<INPUT type="text" name="id">
|
||||
<INPUT type="submit" value="Add to list">
|
||||
</P>
|
||||
</form>
|
||||
List ($count(LIST)):<br>
|
||||
$for(i in LIST)
|
||||
"$i"
|
||||
$endfor
|
||||
</body>
|
||||
</html>
|
||||
5
tutorial/Skylark07/init
Normal file
5
tutorial/Skylark07/init
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef _Skylark07_icpp_init_stub
|
||||
#define _Skylark07_icpp_init_stub
|
||||
#include "Core/init"
|
||||
#include "Skylark/init"
|
||||
#endif
|
||||
39
tutorial/Skylark07/main.cpp
Normal file
39
tutorial/Skylark07/main.cpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#include <Skylark/Skylark.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
SKYLARK(HomePage, "")
|
||||
{
|
||||
http.RenderResult("Skylark07/index");
|
||||
}
|
||||
|
||||
SKYLARK(Submit, "submit:POST")
|
||||
{
|
||||
Value h = http["LIST"];
|
||||
ValueArray va;
|
||||
if(IsValueArray(h))
|
||||
va = h;
|
||||
va.Add(http["id"]);
|
||||
http.SessionSet("LIST", va);
|
||||
http.Redirect(HomePage);
|
||||
}
|
||||
|
||||
struct MyApp : SkylarkApp {
|
||||
MyApp() {
|
||||
root = "myapp";
|
||||
#ifdef _DEBUG
|
||||
prefork = 0;
|
||||
use_caching = false;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
StdLogSetup(LOG_FILE|LOG_COUT);
|
||||
Ini::skylark_log = true;
|
||||
#endif
|
||||
|
||||
MyApp().Run();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue