News
Map
About

 


The Hard Way

The hard way is the obvious way:

on RenderTableAsXXX( tableAdr )
local
outText = ""
<< Open HTML table
<< Walk tableAdr^ and add an HTML table row for each item
<< Close HTML table
return( outText )

Why it's the hard way isn't so obvious, though. Once again, a wealth of sins is concealed by a single glib comment: Walk tableAdr^ and add an HTML table row for each item. In fact, this step involves not just adding <TR> and <TD> tags, but any necessary formatting of the entries. And either the script has to provide a way for you to specify the format externally (perhaps using custom directives) or you will have to modify or replace the script to change the formatting.

So, doing it the hard way, you end up with a script that looks like this:

on RenderTableAsXXX( tableAdr )
local
outText = ""
idx
on Add( s )
outText = outText + s
Add( "<table>\r" )
for idx = 1 to sizeOf( tableAdr^ )
Add( "<tr>" )
Add( "<td><font face='sans-serif'><b>" + nameOf( tableAdr^[idx] ) \
+ "</b></font></td>\r" )
Add( "<td>" + string( tableAdr^[idx] ) + "</td>\r" )
Add( "</tr>\r" )
Add( "</table>\r" )
return( outText )

It ends up cluttered and confusing, and is a pain to maintain and modify.

Now let's look at the easy way to do it!



Page 1: What Is A Table Renderer
Page 2: Anatomy of a Table Renderer
Page 3: The Hard Way
Page 4: The Easy Way
Page 5: The Easiest Way
Page 6: About the Author


News - Map - About ScriptMeridian

This tutorial was written by Samuel Reynolds in Parker, CO.
Page last revised 1999/01/27; 6:09:16 PM.
Copyright © 1998 ScriptMeridian. All rights reserved
All trademarks are the property of their respective owners.
9:30:43 PM 28 January 1999