.Skylark tutorial

git-svn-id: svn://ultimatepp.org/upp/trunk@5139 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-07-06 14:00:18 +00:00
parent 711d716372
commit a27fdcfc7e
11 changed files with 140 additions and 1 deletions

View file

@ -1,6 +1,6 @@
<html>
<body>
<a href=$Page2()>Link to page2</a><br>
<a href=$Page2>Link to page2</a><br>
$for(i in ["param_test", 123, "param_test3"])
<a href=$Param(i)>Param test: $i</a><br>
$endfor

View file

@ -0,0 +1,14 @@
description "FORM GET\377";
uses
Core,
Skylark;
file
index.witz,
submit.witz,
main.cpp;
mainconfig
"" = "SSE2 MT";

View file

@ -0,0 +1,10 @@
<html>
<body>
<form action=$Submit method="get" accept-charset="utf-8" enctype="multipart/form-data">
<P>
<INPUT type="text" name="id">
<INPUT type="submit" value="Submit">
</P>
</form>
</body>
</html>

5
tutorial/Skylark05/init Normal file
View file

@ -0,0 +1,5 @@
#ifndef _Skylark05_icpp_init_stub
#define _Skylark05_icpp_init_stub
#include "Core/init"
#include "Skylark/init"
#endif

View file

@ -0,0 +1,34 @@
#include <Skylark/Skylark.h>
using namespace Upp;
SKYLARK(HomePage, "")
{
http.RenderResult("Skylark05/index");
}
SKYLARK(Submit, "submit")
{
http("RESULT", ToUpper((String)http["id"]))
.RenderResult("Skylark05/submit");
}
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();
}

View file

@ -0,0 +1,6 @@
<html>
<body>
Result: $RESULT<br>
<a href=$HomePage>Back to homepage</a>
</body>
</html>

View file

@ -0,0 +1,14 @@
description "FORM POST\377";
uses
Core,
Skylark;
file
index.witz,
submit.witz,
main.cpp;
mainconfig
"" = "SSE2 MT";

View file

@ -0,0 +1,11 @@
<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="Submit">
</P>
</form>
</body>
</html>

5
tutorial/Skylark06/init Normal file
View file

@ -0,0 +1,5 @@
#ifndef _Skylark06_icpp_init_stub
#define _Skylark06_icpp_init_stub
#include "Core/init"
#include "Skylark/init"
#endif

View file

@ -0,0 +1,34 @@
#include <Skylark/Skylark.h>
using namespace Upp;
SKYLARK(HomePage, "")
{
http.RenderResult("Skylark06/index");
}
SKYLARK(Submit, "submit:POST")
{
http("RESULT", ToUpper((String)http["id"]))
.RenderResult("Skylark06/submit");
}
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();
}

View file

@ -0,0 +1,6 @@
<html>
<body>
Result: $RESULT<br>
<a href=$HomePage>Back to homepage</a>
</body>
</html>