## page was renamed from zhArticleTemplate ##language:zh #pragma section-numbers on ''' 一切从Hello World开始 ''' ::-- ZoomQuiet [<>] == 快速体验 == clearsilver是一个高性能的模版系统,让我们看看他的使用网站,就知道他的表现有多好。 1. Bloglines 2. Google Groups 3. Yahoo Groups 其他的应用请到这里http://www.clearsilver.net/examples.hdf clearsilver由3各部分组成:hdf数据描述,cst模版文件,py逻辑处理向hdf赋值 {{http://www.clearsilver.net/img/misc/Clearsilver-Architecture.gif}} 编写hdf文件:hello.hdf {{{ # This is my static data for Hello World (and this is a comment) Hello = Hello World! WeekDays { 0 = Sunday 1 = Monday 2 = Tuesday 3 = Wednesday 4 = Thursday 5 = Friday 6 = Saturday } }}} 编写模版文件:hello.cst {{{
On ,
On ,
Hey , }}} 这个模版文件唯一要注意的就是'''cs if:?Query.day''',是用来处理链接参数的:cgi-bin/hello.py?day=1 模版语法详见: http://www.clearsilver.net/docs/ 然后将这两部分合二为一: {{{#!python #!/usr/bin/python # # Hello World using the ClearSilver CGI Kit and Python import neo_cgi # create a CGI handler context ncgi = neo_cgi.CGI() # parse the form data (and post upload data) ncgi.parse() # Load our static data ncgi.hdf.readFile("hello.hdf") ncgi.display("hello.cst") }}} P.S: 测试环境winXP+IIS5(懒得装apache了)