KISS HTML

by Jim Browne

Published 1998-10-01    Printer-friendly version

NOTE: Clarion Magazine was not able to obtain an archive of the original source code for this article. If you have the source, we'd very much appreciate it if you would email it to us so we can post it for other readers.

No doubt all Clarion Online readers agree with KISS principles. You know – Keep it Simple Stupid! Well, this is a really simple way of publishing extracts from any Clarion Database on the net. So simple in fact that the Editor will no doubt get lots of angry e-mails about the intellectual levels of some contributing authors.

Well, this author has broad shoulders, so here we go! You might call this "Semi-dynamic HTML". It is a means of producing HTML files that are "Net ready". You do this in much the same way as you would produce a Report. It is a great way to produce price listings or product specifications -- in fact, any net document that needs revision on a regular basis.

All this came to pass because yours truly got involved with trying to destroy (in a good cause and a helpful sort of way) the great little "Freebie" report viewer, RPTVIEW4.CLW, recently released by Simon Brewer. Simon has put a lot of work into this and it is a great replacement for the one you all paid good money for. Amongst those little extra features is the ability to print a report to a text file – either as a selected page, or all pages.

Well, has it hit you yet? It hit me in the middle of the night. Soooo simple!

  • Install RPTVIEW4 in your APP
  • Place the fields you wish to publish in an ordinary report.
  • Surround them with a few, pure (read beautifully fast!) HTML tags.
  • Process the report to Preview stage.
  • Print the report to a Text File with the extension .HTM … and you’re laughing! Instant, net ready "Data.htm".

Ahhh! Think of the possibilities. We just need one of you bright code boys to give us your Sunday afternoon and we can roll this into a ‘One Button’ job. Further up the track, with a bit of reverse engineering, I suspect we could get our Clarion database to respond to incoming XXX.htm messages. Any Volunteers?

Attached Download Code

The download code includes a simple sample database that you can play around with. It also includes a copy of RPTVIEW4.CLW that you will need to install. The installation is simple: The RPTVIEW code simply replaces a block of code in your STDFUNC.TPW template. (Don’t forget to keep a copy of the ORIGINAL STDFUNC.TPW). It also includes HOLIDAY.HTM that you can double click (assuming you have a Browser) to see the end result.

Simon Brewer distributes RPTVIEW4.CLW as RPTVIEW4.zip on Icetips (www.icetips.com) or in the "Free Templates" library on CompuServe. Check them for updates from time to time.

Step by step:

Brdata.gif

Figure 1. Shows the Browse of a simple "Holiday Unit" database.

Opnrpt.gif

Figure 2. Displays the Report structure created in the Database APP. The HTML code is inserted around the Database Fields as required. The display possibilities are almost endless.

Rptview4.GIF

Figure 3. This is the Preview Screen of REPTVIEW. You have arrived here by compiling the APP, running the program and selecting REPORT from the Menu. Click the marked Button to save the REPORT to a TXT file. Set the extension of the Text file to .HTM.)

The following is a section of the generated HTML file. The text has been rearranged to make it a little more readable. I have inserted XXXXXXXXXX to show where the LINK FIELDs fit. In the Database I have deliberately left the LINK FIELD blank. (We would not want to go chasing fairies now – would we?) The information extracted from the Database is shown in Bold type.

<HTML>
<HEAD><TITLE>Happy Holiday</TITLE></HEAD>
<BODY BGColor="000000" Text="ffffff"
Link="80FFFF" VLink="101010">
<H2 Align=Center ><i>
<FONT Color="#8000FF">Holiday in the Mountains
</i></FONT></H2>
<H3 Align=LEFT><FONT
Color="#ffff00"> BACKPACKER </FONT></H3>
<P>
<A HREF="XXXXXXXXXX ">
 STIRLING BACKPACKERS INN …</A>

Modern, well appointed inn. Opposite the Bus depot in central town location. 8 Units accom 34 persons.

<P>
<A HREF="XXXXXXXXXX">THE CAMP …</A>

The latest in Backpacker accommodation. Close to Bus depot in central town location. 6 Units accom 24 persons.

<P>
<H3 Align=LEFT><FONT Color="#ffff00">
 BED & BREAKFAST </FONT></H3>

Lots of code deleted ………………………….……

<A HREF="XXXXXXXXXX">ALPINE VIEW RESORT ... </A>

Attractive landscaped paths lead to comfortable western red cedar units offering enchanting views. Conference Centre, licensed restaurant .

<P>
<BODY>
</HTML>

Htmfile.gif

Figure 4. The final result.

Well now, are you going to give me a "slow clap" and cancel your subscription to Clarion Online?

(Editors Note: That last line is solid proof that we do not believe in censorship<g>)

I hope you are going to "think laterally" about the possibilities of expanding this simple technique to "automating" the connection between CW Databases and the World Wide Web without all the baggage and overheads of so many of the current systems.

Printer-friendly version