To use TWS you don't need active state tcl or even sqlite and not to mention web server. It is all embedded into TWS already.
I am posting here one (raw) example, the one I've used to test TWS suitability. Somebody may find unorthodox the way I use SQL to embedded html tags directly into sql statement but I find that this is incredibly effective. Example I am posting is A little simplistic portal. You have (text) items organized in folders. Folders are used to provide navigation to the left. Click on folder name will produce list of the items with titles (which is clickable) and the short description of the items. Click on the title will move the focus to the content of the item. This script does not provide the means to enter information into the database. You have to find your own way to do that. There is a plenty of tools to do that. I use SqliteExplorer. This was also my fist attempt in Tcl and I was and still I am amazed that the whole script took just that many (little) little lines of code.
You need to create two tables:
create table folder ( folderid, title, description, navind, parentfolder )
create table item ( itemid, title, description, content, content_type, folder )
in sqlite database test.db and provide some test data, and to install the following script. Name is arbitrary and it the extension should be ".tws". It should work as http://localhost/test.tws although the extension is optional in the URL
--------------------------------------- <% sqlite db1 ./test.db
# test for input vars if {[info exists Q(f)]} {set folder $Q(f)} else {set folder 0} if {[info exists Q(i)]} {set item $Q(i)} else {set item 0}
proc sqlex {sqlx} { set x [db1 eval $sqlx ] return [join $x] }
set nav [concat <table> [sqlex " SELECT '<a href=fd?i=0&f=' ||folderid ||'>' ||title ||'</a><br>' FROM folder where navind = 1"] </table> ]
if {$item > 0 } { set cont [concat <table> [sqlex "
SELECT '<b>' ||title ||'</b><br><i>' ||description ||'</i><br>' ||content ||'<br>' FROM item where itemid = $item
"] </table> ] } else { set cont [concat <table> [sqlex " SELECT '<b><a href=fd?i=' ||itemid ||'&f=0>' ||title ||'</a></b><br>' ||description ||'<br>' FROM item where folder = $folder "] </table> ] }
return ; %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title>portal</title> <meta content="borivoj" name="author"> </head> <body> <table style="width: 1008px; height: 60px; text-align: left; margin-left: 0px;" border="0" cellspacing="2" cellpadding="2" > <tbody> <tr> <td colspan="3" style="vertical-align: top;"><br> <b><$Q(f)><$item><$folder><$testq></b> </td> </tr> <tr> <td colspan="3" style="vertical-align: top;"><br> </td> </tr> <tr> <td style="vertical-align: top; width: 20%;"><$nav><br> </td> <td style="vertical-align: top; width: 50%;"><$cont><br> </td> <td style="vertical-align: top; width: 30%;">$rpan<br> </td> </tr> </tbody> </table> <br> <br> </body> </html> -----------------------------------
All the files including tws.exe and the database should be in the same directory.
I am recommendingyou to take a closer look at http://localhost/config (once TWS is started this will take you to the admin. screens) to make yourself familiar with the way TWS operates. Pay attention to the "dispatch" tab.
Hope this will help.
Just a word about tcl. The more I use it the more I like it. In fact my opinion is that TWS is what was missing in tcl ;-) I was doing my web programming on perl before, but now I am seriously considering this combination. Too god to be overlooked
regards
Borivoj
Tom Shafer wrote:
I down-loaded TCL (from ActiveState) and installed on Win2000 Using the 'shell' TCLSH and the TCLSQLite dll and .....Wow! that was simple. Tcl does not appear all that difficult. Why is it not so popular ? All I hear is PHP. ( Obviously I'm not a professional web programmer ! )
However, with my new-found knowledge, I still cannot find SQLITE referenced anywhere in TWS. There is a lot of tcl modules... you mentioned the 'admin' module ???? I found that adding a new user, puts the user's ID into a memory table, but where/how did that table get loaded ? I presume from a SQLite database?
Do you have examples ???
----- Original Message ----- From: "Borivoj" <[EMAIL PROTECTED]> To: "Tom Shafer" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, March 26, 2004 4:47 AM Subject: Re: Fw: [sqlite] TWS for Windows - link
Hi Tom.application
The best example is the admin module of TWS it is written in TWS itself. Download the source and take a look at the code.
Borivoj
On Thu, 25 Mar 2004 19:38:32 -0700, Tom Shafer wrote:
It works !!! on Win2000 !!!
WishList: I would certainly like to see an example database
Iusing SQLite. (maybe its there, but I couldnt find any obvious code).
simple,want to scrap IIS & Sambar & Apache efforts for something far more
easy tolike TWS.
----- Original Message ----- From: "borivoj" <[EMAIL PROTECTED]> Subject: [sqlite] TWS for Windows - link
You can download windows version on http://unicast.org/archives/000508.html, follow the link "installer" While it is still not a single exe file, it works, and it is so
easilyinstall. I have installed it on a Compact Flash drive to move it
PCMCIA CFbetween different machines, one on work and one at home. It is
interestingbut I suppose it will work on USB CF as well. Actually quite
I ampossibility to move web server, database and application that way.
http://www.xs2mail.com/not aware of anything so simple, powerful and useful. Borivoj
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Borivoj
-- XS2Mail: Check your mail anywhere
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]