Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

web site development with tcl

8 views
Skip to first unread message

Harald Kirsch

unread,
Mar 22, 2002, 10:29:03 AM3/22/02
to

What packages support web-site/content management in Tcl?

I recall there are things like a mod_tcl, tcl.cgi, ...

Which is "the best"?

Is there anything as comprehensive as Zope?

Is there at least something for session management, maybe user
management?

Is there something which allows me to write my web-pages in Tcl? Well,
ok, I can always use large numbers of [puts], but there should be
something more convenient like

p {
This is a paragraph with [b some bold text] and a
table border=1 {
tr {
td {blabla}
}
}
}

(In fact I really hate to mix languages like is necessary for Zope and
jsp.)

Harald.

--
----------------+------------------------------------------------------
Harald Kirsch | kirschh bei lionbioscience punkt com
*** Please do not send me copies of your posts. ***

Cameron Laird

unread,
Mar 22, 2002, 10:47:53 AM3/22/02
to
In article <yv2wuw4...@lionsp093.lion-ag.de>,

Harald Kirsch <kir...@lionbioscience.com> wrote:
>
>What packages support web-site/content management in Tcl?
<URL: http://wiki.tcl.tk/602.html >

>
>I recall there are things like a mod_tcl, tcl.cgi, ...
>
>Which is "the best"?
Ha, ha; good joke.

>
>Is there anything as comprehensive as Zope?
Yes: <URL: http://
starbase.neosoft.com/~claird/comp.lang.tcl/server_side_tcl.html#AOLServer >.

>
>Is there at least something for session management, maybe user
>management?
Lots.
.
.
.

>p {
> This is a paragraph with [b some bold text] and a
> table border=1 {
> tr {
> td {blabla}
> }
> }
>}
>
>(In fact I really hate to mix languages like is necessary for Zope and
>jsp.)
Zope allows composition in the style above.
.
.
.
--

Cameron Laird <Cam...@Lairds.com>
Business: http://www.Phaseit.net
Personal: http://starbase.neosoft.com/~claird/home.html

Michael Schlenker

unread,
Mar 22, 2002, 12:32:49 PM3/22/02
to
Harald Kirsch wrote:
> What packages support web-site/content management in Tcl?
>
> I recall there are things like a mod_tcl, tcl.cgi, ...
aolserver? OpenACS?

> Is there something which allows me to write my web-pages in Tcl? Well,
> ok, I can always use large numbers of [puts], but there should be
> something more convenient like

Did you look at the .tml feature of tclhttpd? Does, what you want.

Michael Schlenker


Zoran Vasiljevic

unread,
Mar 22, 2002, 1:38:23 PM3/22/02
to
Harald Kirsch <kir...@lionbioscience.com> wrote in message news:<yv2wuw4...@lionsp093.lion-ag.de>...

> p {

> This is a paragraph with [b some bold text] and a

> table border=1 {

> tr {

> td {blabla}

> }

> }

> }


Not exactly like that, but:

p {
t {This is a paragraph with }
b {some bold text }
t {and a }
table -border 1 -cellpadding 0 {
tr {
td {
t {blabla}
}
}
}
}

I've written a module for AOLserver called tdomtdp which
uses Jochen Loewer's tDOM and builds pages as DOM trees
on the fly.
You can define your own commands for markup, like

% ns_tdp_cmd element_node Harald
% ns_tdp_cmd comment_node Comment
% ns_tdp_cmd text_node Print

and then program like this:

Harald -foo bar {
Comment {Lets repeat Haralds last name in english}
for {set i 0} {$i < 5} {incr i} {
Print {Cherry }
}
}


will yield:

<Harald foo="bar">
<!-- Lets repeat Haralds last name in english -->
Cherry Cherry Cherry Cherry Cherry
</Harald>


It's pretty fast and convenient, since you do not
mix languages at all. On top, you get full syntax
checking of Tcl for free, plus other Tcl goodies...
Because it is not tied to HTML, you can use it to
programatically create just about any XML content.

You'd need the AOLserver for this. Not because it
is architecturally absolutely needed, but it is a
very rich and powerful web development platform
and I use it a lot.

It is still not (really) publicly released, but
couple of people who saw it, liked it very much.

Cheers
Zoran

Darren New

unread,
Mar 22, 2002, 1:47:23 PM3/22/02
to
Harald Kirsch wrote:
> p {
> This is a paragraph with [b some bold text] and a
> table border=1 {
> tr {
> td {blabla}
> }
> }
> }

This is how cgi.tcl works, too. (Well, [p] takes a string, not a
command, but...)

--
Darren New
San Diego, CA, USA (PST). Cryptokeys on demand.
Remember, drive defensively if you drink.

Don Libes

unread,
Mar 22, 2002, 1:31:54 PM3/22/02
to

That looks pretty much like cgi.tcl also. To make it work, change it to:

p "
This is a paragraph with [bold "some bold text"] and a

Todd Coram

unread,
Mar 22, 2002, 2:10:04 PM3/22/02
to
cla...@starbase.neosoft.com (Cameron Laird) wrote in message news:<9AB23D7CAE79AB5F.C58F85AB...@lp.airnews.net>...

> In article <yv2wuw4...@lionsp093.lion-ag.de>,
> Harald Kirsch <kir...@lionbioscience.com> wrote:
> >
> > .
> >p {
> > This is a paragraph with [b some bold text] and a
> > table border=1 {
> > tr {
> > td {blabla}
> > }
> > }
> >}
> >
> >(In fact I really hate to mix languages like is necessary for Zope and
> >jsp.)
> Zope allows composition in the style above.

See Zope Page Templates
(http://www.zope.org/Wikis/DevSite/Projects/ZPT/FrontPage). ZPT was
not designed Python specific (and except for the path syntax, not even
Zope specific). You could implement the language spec
(http://www.zope.org/Wikis/DevSite/Projects/ZPT/LanguageSpecifications)
in Tcl/Aolserver for that matter!
-- todd

Harald Kirsch

unread,
Mar 22, 2002, 3:09:45 PM3/22/02
to
> In article <yv2wuw4...@lionsp093.lion-ag.de>,
> Harald Kirsch <kir...@lionbioscience.com> wrote:

> >Which is "the best"?
> Ha, ha; good joke.

Of course :-)

.
> >p {
> > This is a paragraph with [b some bold text] and a
> > table border=1 {
> > tr {
> > td {blabla}
> > }
> > }
> >}
> >
> >(In fact I really hate to mix languages like is necessary for Zope and
> >jsp.)
> Zope allows composition in the style above.

Heee? I tried Zope a bit for a day now and did not find any hint to that.
Or did you mean to write "AOLserver allows composition in the style above" ?

Thanks for the pointers,
Harald Kirsch .

David N. Welton

unread,
Mar 22, 2002, 3:45:22 PM3/22/02
to
Harald Kirsch <kir...@lionbioscience.com> writes:

> What packages support web-site/content management in Tcl?
>
> I recall there are things like a mod_tcl, tcl.cgi, ...

... mod_dtcl, AOLserver, WebSH ...



> Which is "the best"?

What do you want out of it?

> Is there at least something for session management, maybe user
> management?

WebSH has this. I bet AOLserver does, too.

--
David N. Welton
Consulting: http://www.dedasys.com/
Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
Apache Tcl: http://tcl.apache.org/

Phil Powell

unread,
Mar 22, 2002, 2:20:56 PM3/22/02
to
To be honest, I use Apache 1.3.9 and I code my CGI scripts in TCL, straight,
embedded TCL within HTML tags, and have had no major problems whatsoever.

I am familiar with AOLServer and I believe it operates the same way. You
don't have to generate HTML code, just write it out as-is and the webserver
ignores it, only evaluating what it sees as TCL code to evaluate.

Phil

PS: I didn't think there were anyone else on earth doing web development in
TCL other than myself :(

"Harald Kirsch" <kir...@lionbioscience.com> wrote in message
news:yv2wuw4...@lionsp093.lion-ag.de...
>

Cameron Laird

unread,
Mar 22, 2002, 4:12:36 PM3/22/02
to
In article <16990fa4.02032...@posting.google.com>,

Harald Kirsch <pifp...@gmx.de> wrote:
>cla...@starbase.neosoft.com (Cameron Laird) wrote in message news:<9AB23D7CAE79AB5F.C58F85AB...@lp.airnews.net>...
.
.
.

>> >(In fact I really hate to mix languages like is necessary for Zope and
>> >jsp.)
>> Zope allows composition in the style above.
>
>Heee? I tried Zope a bit for a day now and did not find any hint to that.
>Or did you mean to write "AOLserver allows composition in the style above" ?
.
.
.
See "ZPT", as pointed out also by someone else in this same thread.

David N. Welton

unread,
Mar 22, 2002, 4:12:34 PM3/22/02
to
"Phil Powell" <soa...@erols.com> writes:

> PS: I didn't think there were anyone else on earth doing web
> development in TCL other than myself :(

Tcl and the web have been a huge success, although not as visible as
Perl. CNET, AOL, and many others are not exactly small potatoes.

Darren New

unread,
Mar 22, 2002, 7:27:05 PM3/22/02
to
Phil Powell wrote:
> PS: I didn't think there were anyone else on earth doing web development in
> TCL other than myself :(

I've been doing it for years. In addition, Vignette uses embedded Tcl -
that's the package that makes the web pages with URLs like
http://.../0,123,4567,8.html
You see em all over.

Robert Heller

unread,
Mar 23, 2002, 12:51:01 AM3/23/02
to
"Phil Powell" <soa...@erols.com>,
In a message on Fri, 22 Mar 2002 19:20:56 GMT, wrote :

"P> To be honest, I use Apache 1.3.9 and I code my CGI scripts in TCL, straight,
"P> embedded TCL within HTML tags, and have had no major problems whatsoever.
"P>
"P> I am familiar with AOLServer and I believe it operates the same way. You
"P> don't have to generate HTML code, just write it out as-is and the webserver
"P> ignores it, only evaluating what it sees as TCL code to evaluate.
"P>
"P> Phil
"P>
"P> PS: I didn't think there were anyone else on earth doing web development in
"P> TCL other than myself :(

I no longer write HTML directly anymore. ALL of the web sites I manage
use Tcl-based CGI scripts using tcl.cgi, under a flavor a Apache under
Linux (some also use PostgreSQL via pgtclsh). This makes it trivial to
make all pages have a consistent look. Many of my pages use frames and
have a consistent non-framed version. I can drop a form anywhere. I
can handle any number of forms on any given page, without having to
write many *separate* scripts.

"P>
"P> "Harald Kirsch" <kir...@lionbioscience.com> wrote in message
"P> news:yv2wuw4...@lionsp093.lion-ag.de...
"P> >
"P> > What packages support web-site/content management in Tcl?
"P> >
"P> > I recall there are things like a mod_tcl, tcl.cgi, ...
"P> >
"P> > Which is "the best"?
"P> >
"P> > Is there anything as comprehensive as Zope?
"P> >
"P> > Is there at least something for session management, maybe user
"P> > management?
"P> >
"P> > Is there something which allows me to write my web-pages in Tcl? Well,
"P> > ok, I can always use large numbers of [puts], but there should be
"P> > something more convenient like
"P> >
"P> > p {
"P> > This is a paragraph with [b some bold text] and a
"P> > table border=1 {
"P> > tr {
"P> > td {blabla}
"P> > }
"P> > }
"P> > }
"P> >
"P> > (In fact I really hate to mix languages like is necessary for Zope and
"P> > jsp.)
"P> >
"P> > Harald.
"P> >
"P> > --
"P> > ----------------+------------------------------------------------------
"P> > Harald Kirsch | kirschh bei lionbioscience punkt com
"P> > *** Please do not send me copies of your posts. ***
"P>
"P>
"P>



--
\/
Robert Heller ||InterNet: hel...@cs.umass.edu
http://vis-www.cs.umass.edu/~heller || hel...@deepsoft.com
http://www.deepsoft.com /\FidoNet: 1:321/153

Steve Cassidy

unread,
Mar 23, 2002, 12:08:46 AM3/23/02
to
Harald Kirsch wrote:
> What packages support web-site/content management in Tcl?
> ...

> Is there anything as comprehensive as Zope?

ACS (www.openacs.org) comes close in terms of functionality but not in
terms of ease of installation/management and over the web editing.

> Is there at least something for session management, maybe user
> management?

Websh seems to do some nice session management things although I've not
used it yet.

>
> Is there something which allows me to write my web-pages in Tcl? Well,
> ok, I can always use large numbers of [puts], but there should be
> something more convenient like
>
> p {
> This is a paragraph with [b some bold text] and a
> table border=1 {
> tr {
> td {blabla}
> }
> }
> }
>

cgi.tcl comes close:

package require cgi
cgi_eval {
html {
title "title of the page"
body {
p "This is a pargraph with [bold {some bold text}] \
but no table (since they're not allowed in parargaphs"
table border= 1 {
tr {td inserted automatically}
tr {{isn't} that {clever!}}

}
}
}
}
--
Steve Cassidy............SHLRC, Macquarie University, Sydney, Australia
...............<URL: http://www.shlrc.mq.edu.au/~steve>................

David N. Welton

unread,
Mar 23, 2002, 10:58:54 AM3/23/02
to
Robert Heller <hel...@deepsoft.com> writes:

> I no longer write HTML directly anymore. ALL of the web sites I
> manage use Tcl-based CGI scripts using tcl.cgi, under a flavor a
> Apache under Linux (some also use PostgreSQL via pgtclsh). This
> makes it trivial to make all pages have a consistent look. Many of
> my pages use frames and have a consistent non-framed version. I can
> drop a form anywhere. I can handle any number of forms on any given
> page, without having to write many *separate* scripts.

Sounds like good stuff.

For anyone who's interested in this topic, we of the Apache Tcl group
are always on the lookout for contributions of interesting code, for
which we can provide, in return, a degree of visibility.

J.M. Ivler

unread,
Mar 24, 2002, 3:20:23 AM3/24/02
to
Phil Powell <soa...@erols.com> wrote:
> PS: I didn't think there were anyone else on earth doing web development in
> TCL other than myself :(

since 91 I think... wrote a bit about it in 96. :-)


Harald Kirsch

unread,
Mar 24, 2002, 3:48:02 AM3/24/02
to
Harald Kirsch <kir...@lionbioscience.com> wrote in message news:<yv2wuw4...@lionsp093.lion-ag.de>...

> What packages support web-site/content management in Tcl?
>
> I recall there are things like a mod_tcl, tcl.cgi, ...
>
> Which is "the best"?

Many thanks for all the replies. I had a look at
cgi.tcl which, for a quick and easy start, seems to be just right.

Some questions:

1) For cgi_body, attribute values are automatically put in quotes as
claimed in the docs, but e.g. for h1 this does not work. Is that
intentional?

2) Neither <head> nor <html> are automatically generated contrary
what seems to be indicated in the docs.

Apart from that: Are there any collections of code snippets or even
libraries which contain cgi.tcl-compatible implementations of
common tasks: the typical notebook-tabs (like on amazon) come to mind,
a session manager, good practices for frames vs. noframes, etc?

Harald Kirsch

marsd

unread,
Mar 24, 2002, 9:10:10 AM3/24/02
to
pifp...@gmx.de (Harald Kirsch) wrote in message news:<16990fa4.02032...@posting.google.com>...

Steve Ball's "WebTcl Complete" contains plenty of examples.
There is also a reference which is pretty good with the (ref.txt)
with the library, and there may be sample scripts at expect.nist.gov.

Robert Heller

unread,
Mar 24, 2002, 11:37:27 AM3/24/02
to
pifp...@gmx.de (Harald Kirsch),
In a message on 24 Mar 2002 00:48:02 -0800, wrote :

HK> Harald Kirsch <kir...@lionbioscience.com> wrote in message news:<yv2wuw4...@lionsp093.lion-ag.de>...
HK> > What packages support web-site/content management in Tcl?
HK> >
HK> > I recall there are things like a mod_tcl, tcl.cgi, ...
HK> >
HK> > Which is "the best"?
HK>
HK> Many thanks for all the replies. I had a look at
HK> cgi.tcl which, for a quick and easy start, seems to be just right.
HK>
HK> Some questions:
HK>
HK> 1) For cgi_body, attribute values are automatically put in quotes as
HK> claimed in the docs, but e.g. for h1 this does not work. Is that
HK> intentional?
HK>
HK> 2) Neither <head> nor <html> are automatically generated contrary
HK> what seems to be indicated in the docs.
HK>
HK> Apart from that: Are there any collections of code snippets or even
HK> libraries which contain cgi.tcl-compatible implementations of
HK> common tasks: the typical notebook-tabs (like on amazon) come to mind,
HK> a session manager, good practices for frames vs. noframes, etc?

Visit http://tclads.sourceforge.net/ for some ideas and some code.

HK>
HK> Harald Kirsch
HK>

Don Libes

unread,
Mar 24, 2002, 6:53:46 PM3/24/02
to
pifp...@gmx.de (Harald Kirsch) writes:
> Harald Kirsch <kir...@lionbioscience.com> wrote in message news:<yv2wuw4...@lionsp093.lion-ag.de>...
> Many thanks for all the replies. I had a look at
> cgi.tcl which, for a quick and easy start, seems to be just right.
>
> Some questions:
>
> 1) For cgi_body, attribute values are automatically put in quotes as
> claimed in the docs, but e.g. for h1 this does not work. Is that
> intentional?

Yes, it's intentional. (If you have an attribute that needs to be
quoted, let me know. I've simply never seen an h1 attribute that
did.)

> 2) Neither <head> nor <html> are automatically generated contrary
> what seems to be indicated in the docs.

The library tries to generate things like <head> and <html> when
appropriate, i.e., when the code can tell that they NEED to be
generated. They are not generated otherwise. In my own code, I
follow the recommendation of calling cgi_body in every cgi script.

> Apart from that: Are there any collections of code snippets or even
> libraries which contain cgi.tcl-compatible implementations of
> common tasks: the typical notebook-tabs (like on amazon) come to mind,
> a session manager, good practices for frames vs. noframes, etc?

Sorry, I don't know. If you've got an example, let me know and I can
add it to the online examples at http://expect.nist.gov/cgi.tcl

Don

Harald Kirsch

unread,
Mar 25, 2002, 3:00:31 AM3/25/02
to
Robert Heller <hel...@deepsoft.com> writes:
> I no longer write HTML directly anymore. ALL of the web sites I manage
> use Tcl-based CGI scripts using tcl.cgi, under a flavor a Apache under
> Linux (some also use PostgreSQL via pgtclsh). This makes it trivial to
> make all pages have a consistent look. Many of my pages use frames and
> have a consistent non-framed version. I can drop a form anywhere. I
> can handle any number of forms on any given page, without having to
> write many *separate* scripts.

This is exactly what I had in mind: modular documents.

Given that each and every page is generated on the fly by a Tcl
script, may this cause performance problems? Have you implemented a
means of caching generated HTML? (Not that I am going to develop a
busy website where performance really matters. Just curious.)

Harald Kirsch

--
----------------+------------------------------------------------------


Harald Kirsch | kirschh bei lionbioscience punkt com

Harald Kirsch

unread,
Mar 25, 2002, 3:02:54 AM3/25/02
to
Steve Cassidy <steve....@mq.edu.au> writes:

> Harald Kirsch wrote:
> > What packages support web-site/content management in Tcl?
> > ...
> > Is there anything as comprehensive as Zope?
>
> ACS (www.openacs.org) comes close in terms of functionality but not in
> terms of ease of installation/management and over the web editing.

Uuumpf, in fact I consider 'over the web editing' as a
misfeature of zope ;-|

David N. Welton

unread,
Mar 25, 2002, 3:07:18 AM3/25/02
to
Harald Kirsch <kir...@lionbioscience.com> writes:

> Robert Heller <hel...@deepsoft.com> writes:
> > I no longer write HTML directly anymore. ALL of the web sites I manage
> > use Tcl-based CGI scripts using tcl.cgi, under a flavor a Apache under
> > Linux (some also use PostgreSQL via pgtclsh). This makes it trivial to
> > make all pages have a consistent look. Many of my pages use frames and
> > have a consistent non-framed version. I can drop a form anywhere. I
> > can handle any number of forms on any given page, without having to
> > write many *separate* scripts.
>
> This is exactly what I had in mind: modular documents.

> Given that each and every page is generated on the fly by a Tcl
> script, may this cause performance problems? Have you implemented a
> means of caching generated HTML? (Not that I am going to develop a
> busy website where performance really matters. Just curious.)

You might take a look at something like my CacheOut (see the free
software link below) , although it probably works best with a system
such as mod_dtcl which is persistant across requests.

Harald Kirsch

unread,
Mar 25, 2002, 3:23:54 AM3/25/02
to
Don Libes <li...@nist.gov> writes:

> pifp...@gmx.de (Harald Kirsch) writes:
> > Harald Kirsch <kir...@lionbioscience.com> wrote in message news:<yv2wuw4...@lionsp093.lion-ag.de>...
> > Many thanks for all the replies. I had a look at
> > cgi.tcl which, for a quick and easy start, seems to be just right.
> >
> > Some questions:
> >
> > 1) For cgi_body, attribute values are automatically put in quotes as
> > claimed in the docs, but e.g. for h1 this does not work. Is that
> > intentional?
>
> Yes, it's intentional. (If you have an attribute that needs to be
> quoted, let me know. I've simply never seen an h1 attribute that
> did.)

Well, I was basically thinking in the direction of XHTML/XML where
every attribute must be quoted.

The HTML-generating functions in cgi.tcl could be easily generalized
to XML-generators. For this it would be nice to have a proc which, given a
tag-name, creates a tag-proc (like cgi_h1, cgi_body, etc). The
generated tag-proc takes care of collecting the attributes and does
something with the body. In the general case, handling the body would
involve two orthogonal features:

1) Is the body evaluated, like cgi_body does, passed to [subst], or
takes as is, which I guess is what cgi_p does?

2) Is the result returned, like cgi_b does, or is it pasted on the
current page (which can be a cgi_buffer), like cgi_p, cgi_body do?

The six combinations are
as-is/paste (cgi_p)
as-is/return (cgi_b)
subst/paste
subst/return
evaluate/paste (cgi_table)
evaluate/return (?)

I think the last combination does not appear in cgi.tcl and indeed I
see only limited use for it.

The subst-version would in fact be quite useful for cgi_p because it
would allow to do

p {
some
[b very]
long text
}

instead of

p "
some
[b very]
long text
"

The latter is fairly ugly to handle in Xemacs :-)

Harald Kirsch

Donal K. Fellows

unread,
Mar 25, 2002, 4:39:09 AM3/25/02
to
Robert Heller wrote:
> I no longer write HTML directly anymore. ALL of the web sites I manage
> use Tcl-based CGI scripts using tcl.cgi, under a flavor a Apache under
> Linux (some also use PostgreSQL via pgtclsh). This makes it trivial to
> make all pages have a consistent look. Many of my pages use frames and
> have a consistent non-framed version. I can drop a form anywhere. I
> can handle any number of forms on any given page, without having to
> write many *separate* scripts.

The TIP website at http://purl.org/tcl/tip/ is driven by a single CGI script
written in Tcl (backed up by CVS) and it works by deriving every main content
page from a source format similar to that used on the Wiki. The other pages
(i.e. the advanced search, edit and email forms, plus the master frameset;
search results and indices are rendered from the same codebase as the TIPs
themselves) are coded separately, but that's because the source format doesn't
currently allow for active elements.

Donal.
--
Donal K. Fellows http://www.cs.man.ac.uk/~fellowsd/ fell...@cs.man.ac.uk
"I wouldn't just call you wrong. I'd go further and call you an argumentative
net-kook idiot who can't do his own research before opening his mouth and
yammering bullshit." -- Theo de Raadt <der...@zeus.theos.com>

Donal K. Fellows

unread,
Mar 25, 2002, 4:44:13 AM3/25/02
to
Don Libes wrote:
> Yes, it's intentional. (If you have an attribute that needs to be
> quoted, let me know. I've simply never seen an h1 attribute that
> did.)

The STYLE attribute, which is valid for all elements from 4.0 onwards? I've
never seen a STYLE attribute that did *not* need quoting... :^)

> The library tries to generate things like <head> and <html> when
> appropriate, i.e., when the code can tell that they NEED to be
> generated. They are not generated otherwise. In my own code, I
> follow the recommendation of calling cgi_body in every cgi script.

Is it possible to configure cgi.tcl to use the belt-and-braces approach and
always generate code that validates correctly? For those of us who like to
adhere to standards, <head> and <html> are always appropriate and necessary...

Harald Kirsch

unread,
Mar 25, 2002, 7:20:56 AM3/25/02
to
"Donal K. Fellows" <fell...@cs.man.ac.uk> writes:
> > The library tries to generate things like <head> and <html> when
> > appropriate, i.e., when the code can tell that they NEED to be
> > generated. They are not generated otherwise. In my own code, I
> > follow the recommendation of calling cgi_body in every cgi script.
>
> Is it possible to configure cgi.tcl to use the belt-and-braces approach and
> always generate code that validates correctly? For those of us who like to
> adhere to standards, <head> and <html> are always appropriate and necessary...
>

I for my part would prefer it the other way round. The software should
not try to be cute because all to often this goes wrong. In the case
of cgi.tcl I'd rather like an *explicitly* defined proc to wrap all the
necessary protocol stuff around a bare bones page, e.g. except for the
'...' it would generate all of

<html>
<head>
<title>some default or parameterized title</title>
</head>
<body>
...
</body>
</html>

But anyway I think cgi.tcl is already now a pretty nice package.

Cameron Laird

unread,
Mar 25, 2002, 8:57:15 AM3/25/02
to
In article <yv2pu1t...@lionsp093.lion-ag.de>,
Harald Kirsch <kir...@lionbioscience.com> wrote:
.
.

.
>Uuumpf, in fact I consider 'over the web editing' as a
>misfeature of zope ;-|
.
.
.
I'd like to hear more about this.

Zope's competing with big-ticket "content management"
systems. It's waaaaaay ahead of many of them in that
it's at least sufficiently rational to offer OTW edit-
ing as an *option*, not a requirement. OTW seems to
be absolutely necessary for those customers ...

Are you saying that, as an individual developer, you
dislike (the ergonomics/(in)security/... of) OTW, or
that you think it's a systematic misfeature that
development teams should avoid?

Robert Heller

unread,
Mar 25, 2002, 10:36:55 AM3/25/02
to
Harald Kirsch <kir...@lionbioscience.com>,
In a message on 25 Mar 2002 13:20:56 +0100, wrote :

HK> "Donal K. Fellows" <fell...@cs.man.ac.uk> writes:
HK> > > The library tries to generate things like <head> and <html> when
HK> > > appropriate, i.e., when the code can tell that they NEED to be
HK> > > generated. They are not generated otherwise. In my own code, I
HK> > > follow the recommendation of calling cgi_body in every cgi script.
HK> >
HK> > Is it possible to configure cgi.tcl to use the belt-and-braces approach and
HK> > always generate code that validates correctly? For those of us who like to
HK> > adhere to standards, <head> and <html> are always appropriate and necessary...
HK> >
HK>
HK> I for my part would prefer it the other way round. The software should
HK> not try to be cute because all to often this goes wrong. In the case
HK> of cgi.tcl I'd rather like an *explicitly* defined proc to wrap all the
HK> necessary protocol stuff around a bare bones page, e.g. except for the
HK> '...' it would generate all of
HK>
HK> <html>
HK> <head>
HK> <title>some default or parameterized title</title>
HK> </head>
HK> <body>
HK> ...
HK> </body>
HK> </html>
HK>
HK> But anyway I think cgi.tcl is already now a pretty nice package.

I've taken to defining a foo_HTML proc for my sites:

proc foo_HTML {title body} {
cgi_html {
foo_Header "$title";# Title and meta tags (keywords, description).
cgi_body bgcolor=white {
foo_TopCode;# various 'scenery' at the top...
uplevel "$body"
foo_Footer;# Bottom scenery, including copyright notices and a feather...
}
}
}

I would *not* want auto generation of <html> or other tags. There are
some situations where these tags are in fact not approproate:

proc FeedImage {img} {
cgi_http_head {
cgi_content_type image/[TypeOfImage $img]
cgi_puts "Content-Length: [file size $img]"
}
exec /bin/cat $img >@stdout
}


HK>
HK> Harald Kirsch
HK>

HK> --
HK> ----------------+------------------------------------------------------
HK> Harald Kirsch | kirschh bei lionbioscience punkt com
HK> *** Please do not send me copies of your posts. ***

Darren New

unread,
Mar 25, 2002, 11:54:19 AM3/25/02
to
Harald Kirsch wrote:
> Given that each and every page is generated on the fly by a Tcl
> script, may this cause performance problems? Have you implemented a
> means of caching generated HTML? (Not that I am going to develop a
> busy website where performance really matters. Just curious.)

Don't do it that way.

You can generate the web pages when they change, and store them
statically (as I do at www.fbrtech.com/~dnew/images/ <- Plug!).

Or, if you really want to build things on the fly, generate the page,
cache it under a name related to the URL, and next time check if the
file's still around. Delete all those files when something changes.
Which is what my previous version was doing, since there were much more
complex search criteria, and it worked quite well. I only actually had
to add the cache after people started storing free porn on the server.

Honestly, the performance is unlikely to be a problem. Tcl just isn't
that slow.

I found, however, that in cgi.tcl, I still wound up using [puts] in a
few places to put out tags, because I was doing stuff like

foreach item $biglist {
gen_html_for $item
}

proc gen_html_for item {
output one cell of a table, with
</tr><tr> every 5'th cell.
}

It just didn't nest right, is all. Of course, I could avoid looking up
the HTML by writing the cgi_table_row with the appropriate args, seeing
what it generated, and pasting that into the code. :-)

Jeffrey Hobbs

unread,
Mar 25, 2002, 12:02:05 PM3/25/02
to
Cameron Laird wrote:
>
> In article <yv2pu1t...@lionsp093.lion-ag.de>,
> Harald Kirsch <kir...@lionbioscience.com> wrote:
...
> >Uuumpf, in fact I consider 'over the web editing' as a
> >misfeature of zope ;-|
...
> I'd like to hear more about this.
>
> Zope's competing with big-ticket "content management"
> systems. It's waaaaaay ahead of many of them in that
> it's at least sufficiently rational to offer OTW edit-
> ing as an *option*, not a requirement. OTW seems to
> be absolutely necessary for those customers ...

Zope competes with big-ticket CMS' like xv competes with Photoshop.
I've seen the big-ticket systems at work and they provide a lot
more in terms of management, versioning, customized contrl, etc.
I for one think OTW editing in Zope is also a bad idea, unless they
make a Java or other editing control that edits *tml (dtml in their
case) as well as proper editors (FrontPage, emacs, choose your fav).

I'm looking forward to seeing what happens with the recently
released versioning extensions to WebDAV (RFC 3253). With those on
the server, and a WebDAV aware editor (there are several already),
it could redefine CMS. Remember, not all web servers are external.
This of http(s) local servers that replace CVS servers. For example,
you could turn SourceForge into an imminently easier resource to
access and use (instead of CVS, ssh and all that jazz).

--
Jeff Hobbs The Tcl Guy
Senior Developer http://www.ActiveState.com/
Tcl Support and Productivity Solutions

0 new messages