Texis Web Script source code for: /texis/site/demos/push.vs
Note: Click on links to view the documentation for HTML tags which are special to the Vortex compiler.
<script language=vortex>

<!-- -------------------------------------------------------------------------- 
Notes:

This code example shows how to conduct a multiple part "server push" to the browser
in both an HTML push and a straight image push style.

Since multi-part Mime transmissions require a special header, Vortex is not
allowed to send its own "Content-type" headers, and its up to the
script to send them as required. It is for this reason that the 
<header> function is used, and the exact position of spaces and newlines
is _VERY_ critical. 

The code example also shows how to get images and binary data out of the Texis Database.

--------------------------------------------------------------------------- -->

<export $cat URL USEROK>
<export $delay URL USEROK>
<uses demonav=demonav><!--simple look and feel module-->
<entryfunc=init>              <!-- init function for every invocation -->

<!-- --------------------------------------------------------------------- -->
<a name=init private>
  <sum "%s" $SERVER_ROOT "/texis"><db = $ret>  <!-- set the database -->
</a>

<!-- ---------------------------------------------------------------------- -->

<a name=rapidgifs PUBLIC>
  <header name="Content-Type"
     value="multipart/x-mixed-replace; boundary=--END-OF-DOCUMENT-SECTION--">

  --END-OF-DOCUMENT-SECTION--
  <sql  "select Description,Thumb from image where Category like $cat">
    <if $loop gt 0>
      <sleep $delay>
    </if>
    Content-Type: image/gif

    <fmt "%s\r\n" $Thumb>
    --END-OF-DOCUMENT-SECTION--
    <flush>
  </sql>
</a>

<!-- ---------------------------------------------------------------------- -->

<a name=fm><font face=$face></a>
<a name=/f></font></a>

<!-- ---------------------------------------------------------------------- -->

<a name=thumb PUBLIC>
<header name=Content-Type value=image/gif>
<sql max=1 "select Thumb from image where id=$id">$Thumb</sql>
</a>

<!-- ---------------------------------------------------------------------- -->

<a name=full PUBLIC>
<header name=Content-Type value=image/gif>
<sql max=1 "select Image from image where id=$id"><spew $Image></sql>
</a>

<!-- ---------------------------------------------------------------------- -->

<a name=mainbody>
<demolook title="Server Push Code Example">
<table>
<tr><td valign=top>
<table>
<tr><td align=right><fm>Category:</td><td><fm><b>$Category</b></td></tr>
<tr><td align=right><fm>Rating:</td><td><fm><b>$Rating</b></td></tr>
<tr><td align=right><fm>Width:</td><td><b><fm>$Width</b></td></tr>
<tr><td align=right><fm>Height:</td><td><b><fm>$Height</b></td></tr>
<tr><td align=right><fm>Area:</td><td><b><fm>$Area</b></td></tr>
<tr><td align=right><fm>Colors:</td><td><b><fm>$Colors</b></td></tr>
<tr><td align=right><fm>Type:</td><td><b><fm>$Type</b></td></tr>
<tr><td colspan=2><fm><br><br><h3><a href=$url/>New Search</a></h3></td></tr>
</table>
</td><td><fm>
<h2 align=center>$Description</h2>
<img lowsrc=$url/thumb.gif?id=$id src=$url/full.gif?id=$id height=$Height Width=$Width><br>
</td>
</tr>
</table>
</demolook>
</a>

<!-- ---------------------------------------------------------------------- -->

<a name=htmlpush>
  <header name="Content-Type"
     value="multipart/x-mixed-replace; boundary=--END-OF-DOCUMENT-SECTION--">

  --END-OF-DOCUMENT-SECTION--
  <sql "select id, Rating, Width, Height, Area, Colors, Type, Category,
          Description
        from image
        where Category like $cat">
    <if $loop gt 0>
      <sleep $delay>
    </if>
    Content-Type: text/html

    <mainbody>
    --END-OF-DOCUMENT-SECTION--
    <flush>
  </sql>
</a>

<!-- ---------------------------------------------------------------------- -->

<a name=imagepush>
  <header name="Content-Type" value="text/html">
  <demolook title="Server Push Code Example">
  <table>
  <tr>
    <td><fm>
      <h2>Pushing Images from:</h2>
      <loop $cat>$cat<br></loop>
      <hr>
      <showform>
    </td>
    <td><fm>
      <image src=$url/rapidgifs.gif width=128 height=128>
      <image src=$url/rapidgifs.gif width=128 height=128><br>
      <image src=$url/rapidgifs.gif width=128 height=128>
      <image src=$url/rapidgifs.gif width=128 height=128>
      <h3 align=center><a href=$url/>Go Back</a></h3>
    </td>
  </tr>
  </table>
</demolook>
</a>

<!-- ---------------------------------------------------------------------- -->

<a name=showtime PUBLIC>
<$delay = $formdelay>
<$cat = $formcat>
<IF $cat eq "">
  <$cat = "Animals">
</IF>
<if $delay lt 1>
  <$delay = 1>
</if>
<if $thumbnails neq "">
  <imagepush>
</if>
<if $all_info neq "">
   <htmlpush>
</if>
</a>

<!-- ---------------------------------------------------------------------- -->

<a name=showform>
<center>
<form method=post action=$url/showtime.gif>
<sql "select Category from image"/>
<uniq $Category>
Categories:<br>
<select name=formcat multiple size=10>
  <options $ret $cat $ret>
</select><br>
Delay:<select name=formdelay>
<$val = 1 2 5 10 20 30>
<IF $delay eq "">
  <$delay = 5>
</IF>
<options $val $delay $val>
</select> Secs.<br>
<input type=submit name=thumbnails value="Just Thumbnails"><br>
<input type=submit name=all_info   value="All Information"><br>
<center>
</form>
</a>


<!-- ---------------------------------------------------------------------- -->

<a name=main PUBLIC>
<demolook title="Texis Server Push Code Example">
<!--
<rex "MSIE" $HTTP_USER_AGENT>
<if $ret ne "">
 <h3> Microsoft Explorer does not support <a href="http://home.netscape.com/assist/net_sites/pushpull.html">server-push</a>
      <br> Please use Netscape 2+ for this code example
 </h3>
<exit>
</if>
-->
<h2 align=center> Processing Images with Texis </h2>
<table>
<tr><td><fm>
<showform>
</td>
</tr>
<tr>
<td><fm>
Texis allows "objects" to be stored within a database.
The most common objects are images and audio.<p>
This code example shows a couple of novel ways that images may be 
delivered from Texis to a web browser.
<p>
Just <b>maximize</b> your browser window, select a couple of categories and click the "All Information" button.
<p>
On the technical side,
this code example shows how to conduct multi-part Mime transmissions via "server push" to the browser.
It shows both an HTML push and a straight image push. 
<p>
</td>
<tr>
</table> 
</demolook>
</a>

</script>

Back to the Code Example List

The Source Viewer is also a Code Example.
Click Here to see its source.
Copyright © 1992-1999 Thunderstone Software
Copyright © 2024 Thunderstone Software LLC. All rights reserved.