[ UP ] update cgi's manager_user.lua
[archserver.git] / cgi / how-to.txt
blob4cf7daa2ed76405b50b93af2754c48bb4684e84e
1 ################################################
2 # First released by kylin 2008.09.11                                            #
3 #################################################
5 How to write a cgi page
7                  Now, the cgi files is written by shell script.         Generally, a page consists of 3 parts: header, 
8 body, and footer. The "header" and "foter" part has been defined in library file.  You can call
9 it directyly with "h_header" and "h_footer" functions. so at most time, you only need to write the
10  "body" part.  
12                 A cgi file looks like this:
14                                                                                                 ########## cgi file #######
16                                                                                                                                 #!/bin/sh
18                                                                                                                                 this_page="share.list_user"
19                                                                                                                                 source lib.sh
20                                                                                                                                 source proccgi.sh
22                                                                                                                                 /* header function */
23                                                                                                                                 h_header
25                                                                                                                                 /*  body part: do what you want. */
27                                                                                                                                 /* footer function */
28                                                                                                                                 h_footer        
30                                                                                                 ######## cgi file ########
32         The variable "this_page" should be defined every page. Usually it consists two words seperated by "." sign. 
33 for example "share.list_user". the first word "share" is to define the pages active global navigation. the second
34 word defines the pages active sub navigation. 
35         There are also 2 library files. "lib.sh" contains the "header" and "footer" functions. "proccgi.sh" is used to
36 process CGI variables. Every cgi variable has a "$F_" as the prefix. For example, variable "ipaddr" should be 
37 called as "$F_ipaddr" in cgi file.
39 enjoy it !