summaryrefslogtreecommitdiff
path: root/examples/webware_examples/cheetahSite/index.tmpl
blob: c5d251433ec838cfe5c58099f0ebd164465f37e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
#from SiteTemplate import SiteTemplate
#extends SiteTemplate
#implements writeMainContentsCell



<P>
Cheetah is a Python-powered template engine and code generator.  It can be used
as a standalone utility or it can be combined with other tools.  Cheetah has
many potential uses, but web developers looking for a viable alternative to ASP,
JSP, PHP and PSP are expected to be its principle user group.

<P>
Cheetah:

<UL>
<LI>generates HTML, SGML, XML, SQL, Postscript, form email, LaTeX, or any
     other text-based format.

<P>
</LI>
<LI>cleanly separates content, graphic design, and program code.  This leads
     to highly modular, flexible, and reusable site architectures; faster
     development time; and HTML and program code that is easier to understand
     and maintain. It is particularly well suited for team efforts.

<P>
</LI>
<LI>blends the power and flexibility of Python with a simple template language
     that non-programmers can understand.

<P>
</LI>
<LI>gives template writers full access to any Python data structure, module,
     function, object, or method in their templates.

<P>
</LI>
<LI>makes code reuse easy by providing an object-orientated interface to
     templates that is accessible from Python code or other Cheetah templates.
     One template can subclass another and selectively reimplement sections of
     it.

<P>
</LI>
<LI>provides a simple, yet powerful, caching mechanism that can dramatically
     improve the performance of a dynamic website.

<P>
</LI>
<LI>compiles templates into optimized, yet readable, Python code.
</LI>
</UL>

<P>
Cheetah integrates tightly with <B>Webware for Python</B>
(<a class="url" href="http://webware.sourceforge.net/">http://webware.sourceforge.net/</a>): a Python-powered application server and
persistent servlet framework. Webware provides automatic session, cookie, and
user management and can be used with almost any operating-system, web server, or
database. Through Python, it works with XML, SOAP, XML-RPC, CORBA, COM, DCOM,
LDAP, IMAP, POP3, FTP, SSL, etc.. Python supports structured exception handling,
threading, object serialization, unicode, string internationalization, advanced
cryptography, and more. It can also be extended with code and libraries written
in C, C++, Java and other languages.

<P>
Like Python, Cheetah and Webware are Open Source Software and are supported by
active user communities.  Together, they are a powerful and elegant framework
for building dynamic web sites.


<P>
Like its namesake, Cheetah is fast, flexible and powerful.

<P>

<H2><A NAME="SECTION000220000000000000000">&nbsp;</A>
<BR>
Give me an example!
</H2>

<P>
Here's a very simple example that illustrates some of Cheetah's basic syntax:

<P>
<dl><dd><pre class="verbatim">
&lt;HTML&gt;
&lt;HEAD&gt;&lt;TITLE&gt;$title&lt;/TITLE&gt;&lt;/HEAD&gt;
&lt;BODY&gt;

&lt;TABLE&gt;
#for $client in $clients
&lt;TR&gt;
&lt;TD&gt;$client.surname, $client.firstname&lt;/TD&gt;
&lt;TD&gt;&lt;A HREF="mailto:$client.email"&gt;$client.email&lt;/A&gt;&lt;/TD&gt;
&lt;/TR&gt;
#end for
&lt;/TABLE&gt;

&lt;/BODY&gt;
&lt;/HTML&gt;
</pre></dl>

<P>
Compare this with PSP:

<P>
<dl><dd><pre class="verbatim">
&lt;HTML&gt;
&lt;HEAD&gt;&lt;TITLE&gt;&lt;%=title%&gt;&lt;/TITLE&gt;&lt;/HEAD&gt;
&lt;BODY&gt;

&lt;TABLE&gt;
&lt;% for client in clients: %&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;%=client['surname']%&gt;, &lt;%=client'[firstname']%&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;A HREF="mailto:&lt;%=client['email']%&gt;"&gt;
&lt;%=client['email']%&gt;&lt;/A&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;%end%&gt;
&lt;/TABLE&gt;

&lt;/BODY&gt;
&lt;/HTML&gt;
</pre></dl>

<P>

<H2><A NAME="SECTION000230000000000000000">&nbsp;</A>
<BR>
What is the philosophy behind Cheetah?
</H2>

<P>
Cheetah's design was guided by these principles:

<UL>
<LI>Python for the back end, Cheetah for the front end.  Cheetah was
     designed to complement Python, not replace it.

<P>
</LI>
<LI>Cheetah's core syntax should be easy for non-programmers to learn.

<P>
</LI>
<LI>Cheetah should make code reuse easy by providing an object-oriented
     interface to templates that is accessible from Python code or other
     Cheetah templates.

<P>
</LI>
<LI>Python objects, functions, and other data structures should be fully
     accessible in Cheetah.

<P>
</LI>
<LI>Cheetah should provide flow control and error handling.  Logic
     that belongs in the front end shouldn't be relegated to the
     back end simply because it's complex.

<P>
</LI>
<LI>It should be easy to <B>separate</B> content, graphic design, and program
     code, but also easy to <B>integrate</B> them.

<P>
A clean separation makes it easier for a team of content writers,
     HTML/graphic designers, and programmers to work together without stepping
     on each other's toes and polluting each other's work.  The HTML framework
     and the content it contains are two separate things, and analytical
     calculations (program code) is a third thing.  Each team member should be
     able to concentrate on their specialty and to implement their changes
     without having to go through one of the others (i.e., the dreaded
     ``webmaster bottleneck'').

<P>
While it should be easy to develop content, graphics and program
     code separately, it should be easy to integrate them together into a
     website.  In particular, it should be easy:

<P>

<UL>
<LI>for <B>programmers</B> to create reusable components and functions
          that are accessible and understandable to designers.
</LI>
<LI>for <B>designers</B> to mark out placeholders for content and
          dynamic components in their templates.
</LI>
<LI>for <B>designers</B> to soft-code aspects of their design that are
          either repeated in several places or are subject to change.
</LI>
<LI>for <B>designers</B> to reuse and extend existing templates and thus
          minimize duplication of effort and code.
</LI>
<LI>and, of course, for <B>content writers</B> to use the templates that
          designers have created.

</LI>
</UL>

<P>
</LI>
</UL>

<P>

<P>
<H2><A NAME="SECTION000260000000000000000">&nbsp;</A>
<BR>
How mature is Cheetah?
</H2>

<P>
Cheetah is alpha software as some aspects of its design are
still subject to change and the Users' Guide is incomplete.
We plan to release a stable version later in 2001.

################################################################################
## reimplement a few other methods from SiteTemplate

#def writeLocationBar
#end def 

#def writeLeftSideBar
<BR>
<a href=http://lists.sourceforge.net/mailman/listinfo/cheetahtemplate-discuss><B>Mailing&nbsp;List</B></a>
<BR>
<A HREF="http://sourceforge.net/cvs/?group_id=28961"><B>CVS</B></A><BR>
#end def 

################################################################################