You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-cvs@tcl.apache.org by da...@apache.org on 2001/03/19 19:12:45 UTC

cvs commit: tcl-site/mod_dtcl documentation.html examples.ttml

davidw      01/03/19 10:12:45

  Modified:    .        examples.ttml
               mod_dtcl documentation.html examples.ttml
  Log:
  Updated examples.ttml and documentation.html with new syntax, features.
  
  Revision  Changes    Path
  1.3       +38 -36    tcl-site/examples.ttml
  
  Index: examples.ttml
  ===================================================================
  RCS file: /home/cvs/tcl-site/examples.ttml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- examples.ttml	2001/03/19 18:08:45	1.2
  +++ examples.ttml	2001/03/19 18:12:39	1.3
  @@ -1,6 +1,6 @@
   <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN">
   <html>
  -<!-- $Id: examples.ttml,v 1.2 2001/03/19 18:08:45 davidw Exp $ -->
  +<!-- $Id: examples.ttml,v 1.3 2001/03/19 18:12:39 davidw Exp $ -->
   <title>mod_dtcl examples</title>
   <body bgcolor=white>
   
  @@ -22,14 +22,18 @@
   <tr><td><hr><b>Hello world</b></td></tr>
   <tr><td bgcolor=gray><pre>
   
  -&lt;+
  -setcookie "foo" "bar" # we have to put this before any 'hputs' statements
  +&lt;?
  +headers setcookie "foo" "bar" # we have to put this before any 'hputs' statements
   
  +# once buffering is switched off, it is no longer possible to
  +# maninuplate headers
  +buffered off
  +
   hputs "Hello world"
  -+&gt;
  +?&gt;
   
   </pre>
  -</td></tr>
  +	  </td></tr>
   
   <tr><td>
   Produces:
  @@ -56,11 +60,11 @@
   
   <tr><td bgcolor=gray><pre>
   
  -&lt;+ if { 1 } { +&gt;
  +&lt;? if { 1 } { ?&gt;
   
  -&lt;h2> True &lt;/h2>
  +&lt;h2&gt; True &lt;/h2&gt;
   
  -&lt;+ }  +&gt;
  +&lt;? }  ?&gt;
   
   </td></tr></pre>
   
  @@ -80,16 +84,16 @@
   
   <tr><td bgcolor=gray><pre>
   
  -&lt;+ 
  +&lt;? 
   set x 0 
   while { $x &lt; 5 } { 
    hputs "\$x = $x&lt;br>"
    incr x
  -+&gt;
  +?&gt;
   
   LOOP&lt;br>
   
  -&lt;+ }  +&gt;
  +&lt;? }  ?&gt;
   
   </pre>
   </td></tr>
  @@ -109,7 +113,7 @@
   </td></tr>
   <tr><td bgcolor=gray><pre>
   
  -&lt;+ 
  +&lt;? 
    hgetvars
   if { [ array exists VARS ] } {
       hputs "&lt; ul>"
  @@ -137,7 +141,7 @@
       hputs "&lt;/ul>"
   }
   
  -+&gt;
  +?&gt;
   
   </pre>
   </td></tr>
  @@ -176,52 +180,50 @@
   <tr><td><hr><b>Create a table on the fly</b><p>
   </td></tr>
   <tr><td bgcolor=gray><pre>
  -
  -&lt;+
   
  -set listone { 1 2 3 4 5 6 7 8 }
  -set listtwo { 1 2 3 4 5 6 7 8 }
  -
  +&lt;?
  +set i 1
   hputs "&lt;table&gt;\n"
   
  -foreach { a } $listone  { 
  +while { $i &lt;= 8 } {
       hputs "&lt;tr&gt;\n"
  -    foreach { b } $listtwo {
  -	set num [ expr $a * $b * 4 - 1 ]
  -	hputs [ format "&lt;td bgcolor=%2x%2x%2x &gt;  $num $num $num &lt;/td&gt;\n" $num $num $num ]
  +    for {set j 1} {$j &lt;= 8} {incr j} {
  +	set num [ expr $i * $j * 4 - 1]
  +	hputs [ format "&lt;td bgcolor=%2x%2x%2x &gt; $num $num $num &lt;/td&gt;\n" $num $num $num ]
       }
  +    incr i
       hputs "&lt;/tr&gt;\n"
   }
  -hputs "&lt;/table&gt;\n"
  -+&gt;
   
  -
  +hputs "&lt;/table&gt;\n"
  +?&gt;
   </pre>
   </td></tr>
   
   <tr><td>Produces:<p>
   <?
  -
  -set listone { 1 2 3 4 5 6 7 8 }
  -set listtwo { 1 2 3 4 5 6 7 8 }
  -
  +set i 1
   hputs "<table>\n"
   
  -foreach { a } $listone  { 
  +while { $i <= 8 } {
       hputs "<tr>\n"
  -    foreach { b } $listtwo {
  -	set num [ expr $a * $b * 4 - 1]
  +    for {set j 1} {$j <= 8} {incr j} {
  +	set num [ expr {$i * $j * 4 - 1} ]
   	hputs [ format "<td bgcolor=%2x%2x%2x > $num $num $num </td>\n" $num $num $num ]
       }
  +    incr i
       hputs "</tr>\n"
   }
  +
   hputs "</table>\n"
   ?>
   </td></tr>
   
  -<tr><td><hr>
  -<b>In addition</b><br>
  -There are many, many other things you can do with mod_dtcl.  You can, if everything is compiled right, load tcl modules, like libpgtcl.so, so that you can interact with a database!
  +<tr><td><hr> <b>In addition</b><br> 
  +
  +There are many, many other things you can do with mod_dtcl.  You can,
  +if everything is compiled right, load tcl modules, like libpgtcl.so
  +(the Postgresql interface), so that you can interact with a database!
   
   <p>
   
  @@ -233,7 +235,7 @@
   
   
   <p>
  -<a href="index.html">Return to the mod_dtcl homepage</a>
  +<a href="index.ttml">Return to the mod_dtcl homepage</a>
   </p>
   
   </body>
  
  
  
  1.5       +51 -8     tcl-site/mod_dtcl/documentation.html
  
  Index: documentation.html
  ===================================================================
  RCS file: /home/cvs/tcl-site/mod_dtcl/documentation.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- documentation.html	2001/02/08 13:22:18	1.4
  +++ documentation.html	2001/03/19 18:12:42	1.5
  @@ -1,4 +1,4 @@
  -<!-- $Id -->
  +<!-- $Id: documentation.html,v 1.5 2001/03/19 18:12:42 davidw Exp $ -->
         <h2>mod_dtcl Documentation</h2>
         
         <h3>1) Installation</h3>
  @@ -189,7 +189,7 @@
   
         </ul>
   
  -      <h3>3) mod_dtcl specific Tcl commands</h3>
  +      <h3>3) mod_dtcl specific Tcl commands and variables</h3>
   
         <ul>
   	<li>
  @@ -237,8 +237,8 @@
   	  URI. <b>Must</b> be done in the first block of TCL code.
   	</li>
   	<li>
  -	  <code><b>headers setcookie <i>cookie-name
  -		cookie-value ?-expires date/time? ?-domain domain?
  +	  <code><b>headers setcookie <i>-name cookie-name
  +		-value cookie-value ?-expires date/time? ?-domain domain?
   		?-path path? ?-secure?</i></b></code><br>
   
   	  This command is for setting cookies.  Cookie-name is
  @@ -271,6 +271,21 @@
   	  HTML.  Currently, only the PID and size of the object
   	  cache are reported.
   	</li>
  +
  +	<li>
  +	  <code><b>$::request::UPLOAD(filename)</b></code><br>
  +	  The filename of the uploaded file.
  +	  <code><b>$::request::UPLOAD(name)</b></code><br>
  +	  The form variable name of the upload.
  +	  <code><b>$::request::UPLOAD(size)</b></code><br>
  +	  The size of the uploaded file.
  +	  <code><b>$::request::UPLOAD(type)</b></code><br>
  +	  The content type of the file upload. <i>Not always available!</i>
  +	  <code><b>$::request::UPLOAD(channelname)</b></code><br>
  +	  The name of a Tcl channel which may be used to manipulate
  +	  the uploaded file.
  +	</li>
  +
         </ul>
   
         <h3>4) Internals</h3>
  @@ -305,8 +320,8 @@
   	  share variables, and most importantly, loaded modules,
   	  from a common parent (such as one of the InitScripts).
   	  When a file is loaded, it is transformed into a Tcl
  -	  script by putting everything outside of &lt;+ and
  -	  +&gt; into large hputs statements.  When the script is
  +	  script by putting everything outside of &lt;? and
  +	  ?&gt; into large hputs statements.  When the script is
   	  complete, it is then inserted into the cache, for
   	  future use.  In fact, if the file modification
   	  information doesn't change, mod_dtcl will execute the
  @@ -318,9 +333,28 @@
   	  images, or loading binary data with 'include'.
   	</li>
         </ul>
  -      
  -      <h3>5) Getting Help</h3>
  +
  +      <h3>5) Upgrading From Older (< 0.9.3) Versions</h3>
         <ul>
  +	<li><b>New tags</b><br> As of version 0.9.4, mod_dtcl uses
  +	  &lt;? and ?&gt; instead of &lt;+ and +&gt; to delimit
  +	  sections of Tcl code.  By default, dtcl is still compiled
  +	  with code to parse the &lt;?  ?&gt; tags, but it will run
  +	  faster if <code>USE_OLD_TAGS</code> is set to 0 in
  +	  <code>mod_dtcl.h</code>.  You can automatically change your
  +	  .ttml files to the new format by using the
  +	  <code>newtags.sh</code> script in the contrib/ directory.
  +	  Run it at the top level of your DocumentRoot.
  +	</li>
  +	<li><b>headers setcookie</b><br>
  +	  The <code>headers setcookie</code> command now uses the
  +	  <code>-name</code> and <code>-value</code> flags for those
  +	  arguments, whereas this was not necessary in the past.
  +	</li>
  +      </ul>
  +
  +      <h3>6) Getting Help</h3>
  +      <ul>
   	<li><b>Mailing list</b><br>
   	  <p>
   	    The mod_dtcl mailing list is the best place to go for help
  @@ -339,3 +373,12 @@
   	  </p>
   	</li>
         </ul>
  +
  +      
  +      <!-- The load dtd is so that I can work on the documentation
  +      with emacs' SGML in all its glory - davidw  -->
  +
  +      <!-- Local Variables: -->
  +      <!-- eval: (sgml-load-dtd "~/html.ced") -->
  +      <!-- End: -->
  +      
  \ No newline at end of file
  
  
  
  1.4       +25 -23    tcl-site/mod_dtcl/examples.ttml
  
  Index: examples.ttml
  ===================================================================
  RCS file: /home/cvs/tcl-site/mod_dtcl/examples.ttml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- examples.ttml	2001/03/19 18:11:36	1.3
  +++ examples.ttml	2001/03/19 18:12:43	1.4
  @@ -1,6 +1,6 @@
   <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN">
   <html>
  -<!-- $Id: examples.ttml,v 1.3 2001/03/19 18:11:36 davidw Exp $ -->
  +<!-- $Id: examples.ttml,v 1.4 2001/03/19 18:12:43 davidw Exp $ -->
   <title>mod_dtcl examples</title>
   <body bgcolor=white>
   
  @@ -25,11 +25,15 @@
   &lt;?
   headers setcookie "foo" "bar" # we have to put this before any 'hputs' statements
   
  +# once buffering is switched off, it is no longer possible to
  +# maninuplate headers
  +buffered off
  +
   hputs "Hello world"
   ?&gt;
   
   </pre>
  -</td></tr>
  +	  </td></tr>
   
   <tr><td>
   Produces:
  @@ -58,7 +62,7 @@
   
   &lt;? if { 1 } { ?&gt;
   
  -&lt;h2> True &lt;/h2>
  +&lt;h2&gt; True &lt;/h2&gt;
   
   &lt;? }  ?&gt;
   
  @@ -178,50 +182,48 @@
   <tr><td bgcolor=gray><pre>
   
   &lt;?
  -
  -set listone { 1 2 3 4 5 6 7 8 }
  -set listtwo { 1 2 3 4 5 6 7 8 }
  -
  +set i 1
   hputs "&lt;table&gt;\n"
   
  -foreach { a } $listone  { 
  +while { $i &lt;= 8 } {
       hputs "&lt;tr&gt;\n"
  -    foreach { b } $listtwo {
  -	set num [ expr $a * $b * 4 - 1 ]
  -	hputs [ format "&lt;td bgcolor=%2x%2x%2x &gt;  $num $num $num &lt;/td&gt;\n" $num $num $num ]
  +    for {set j 1} {$j &lt;= 8} {incr j} {
  +	set num [ expr $i * $j * 4 - 1]
  +	hputs [ format "&lt;td bgcolor=%2x%2x%2x &gt; $num $num $num &lt;/td&gt;\n" $num $num $num ]
       }
  +    incr i
       hputs "&lt;/tr&gt;\n"
   }
  +
   hputs "&lt;/table&gt;\n"
   ?&gt;
  -
  -
   </pre>
   </td></tr>
   
   <tr><td>Produces:<p>
   <?
  -
  -set listone { 1 2 3 4 5 6 7 8 }
  -set listtwo { 1 2 3 4 5 6 7 8 }
  -
  +set i 1
   hputs "<table>\n"
   
  -foreach { a } $listone  { 
  +while { $i <= 8 } {
       hputs "<tr>\n"
  -    foreach { b } $listtwo {
  -	set num [ expr $a * $b * 4 - 1]
  +    for {set j 1} {$j <= 8} {incr j} {
  +	set num [ expr {$i * $j * 4 - 1} ]
   	hputs [ format "<td bgcolor=%2x%2x%2x > $num $num $num </td>\n" $num $num $num ]
       }
  +    incr i
       hputs "</tr>\n"
   }
  +
   hputs "</table>\n"
   ?>
   </td></tr>
   
  -<tr><td><hr>
  -<b>In addition</b><br>
  -There are many, many other things you can do with mod_dtcl.  You can, if everything is compiled right, load tcl modules, like libpgtcl.so, so that you can interact with a database!
  +<tr><td><hr> <b>In addition</b><br> 
  +
  +There are many, many other things you can do with mod_dtcl.  You can,
  +if everything is compiled right, load tcl modules, like libpgtcl.so
  +(the Postgresql interface), so that you can interact with a database!
   
   <p>