File: web_errors.html

package info (click to toggle)
funnelweb-doc 3.2d-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,740 kB
  • sloc: perl: 241; makefile: 23
file content (400 lines) | stat: -rw-r--r-- 12,910 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400

<HTML>
<!--
***********************************************************************
FUNNELWEB MANUAL WEB PAGE
=========================
Copyright (c) Ross N. Williams 1992,1999. All rights reserved.

Permission is granted to redistribute and use this manual in
any medium, with or without modification, provided that all
notices (including, without limitation, the copyright
notice, this permission notice, any record of modification,
and all legal notices) are preserved on all copies, that all
modifications are clearly marked, and that modified versions
are not represented as the original version unless all the
modifications since the manual's original release by Ross N.
Williams (www.ross.net) consist of translations or other
transformations that alter only the manual's form, not its
content. THIS MANUAL IS PROVIDED "AS IS" AND WITHOUT ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
FITNESS FOR A PARTICULAR PURPOSE. TO THE EXTENT PERMITTED BY
LAW THERE IS ABSOLUTELY NO WARRANTY.

***********************************************************************
-->

<HEAD>
<TITLE>7.4 Avoiding Errors And Inconsistencies</TITLE>
<STYLE TYPE="text/css"> <!-- A {text-decoration: none} // --> </STYLE>
</HEAD>
<BODY BACKGROUND="binary/background.gif"
      BGCOLOR="#FFFFFF"
      TEXT="#000000"
      VLINK="#660000"
      LINK="#FF0000"
      ALINK="#CC0000">

<TABLE WIDTH="490">
<TR>
<TD WIDTH="130" VALIGN="top">
<IMG SRC="binary/d_clear.gif" ALT="" WIDTH="130" HEIGHT="1"><BR>

<FONT SIZE="2">
<BR>

<A HREF="http://www.ross.net/"
 TARGET="rosshome"
 onClick="window.open('','rosshome','location,status,menubar,scrollbars,resizable',false).focus(); return true;"
>
 <IMG SRC="binary/rossnet_logo.gif"
  WIDTH="64" HEIGHT="32"
  BORDER="0" ALT="RossNet"
  HSPACE="0" VSPACE="1"></A><BR>
<BR>

<A HREF="../index.shtml"
 TARGET="funnelweb"
 onClick="window.open('','funnelweb','location,status,menubar,scrollbars,resizable',false).focus(); return true;"
>
 <IMG SRC="binary/linklogo.gif"
  WIDTH="64" HEIGHT="32"
  BORDER="0" ALT="FunnelWeb"
  HSPACE="0" VSPACE="1"></A><BR>
<BR>
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD BGCOLOR="#000000">
<A HREF="../reference/index.html"
 TARGET="funnelwebreference"
 onClick="window.open('','funnelwebreference','location,status,menubar,scrollbars,resizable',false).focus(); return true;"
><FONT COLOR="#FFFFFF"><B>Reference</B></FONT></A><BR>
<BR>
<A HREF="../developer/index.html"
 TARGET="funnelwebdeveloper"
 onClick="window.open('','funnelwebdeveloper','location,status,menubar,scrollbars,resizable',false).focus(); return true;"
><FONT COLOR="#FFFFFF"><B>Developer</B></FONT></A><BR>
<BR>
<A HREF="index.html"><FONT COLOR="#FFFFFF"><B>Tutorial</B></FONT></A><BR>
<A HREF="intro.html"><FONT COLOR="#FFFFFF">1 Introduction</FONT></A><BR>
<A HREF="macro.html"><FONT COLOR="#FFFFFF">2 Macros</FONT></A><BR>
<A HREF="type.html"><FONT COLOR="#FFFFFF">3 Typesetting</FONT></A><BR>
<A HREF="example.html"><FONT COLOR="#FFFFFF">4 Example</FONT></A><BR>
<A HREF="hints.html"><FONT COLOR="#FFFFFF">5 Hints</FONT></A><BR>
<A HREF="examples.html"><FONT COLOR="#FFFFFF">6 Examples</FONT></A><BR>
<A HREF="web.html"><FONT COLOR="#FFFFFF">7 Webmaking</FONT></A><BR>

<BR>
<A HREF="search.html"><FONT COLOR="#FFFFFF"><B>SEARCH</B></FONT></A><BR>
</FONT>
</TD></TR></TABLE>


</TD>
<TD WIDTH="360" VALIGN="top">
<FONT SIZE="3">


<A HREF="../reference/index.html"><IMG SRC="binary/title.gif"
 WIDTH="302" HEIGHT="24"
 BORDER="0" ALT="FunnelWeb Tutorial Manual"
 HSPACE="0" VSPACE="0"></A>
<P><FONT SIZE="5">7.4 Avoiding Errors And Inconsistencies</FONT><BR>


<P>FunnelWeb provides the opportunity to eliminate all kinds of
errors and inconsistencies by replacing text names with FunnelWeb
macro names that cannot be misspelt without being detected by FunnelWeb.
This page provides some examples of this.

<P><BR><FONT SIZE="4"><STRONG>Minor Style Elements</STRONG></FONT><BR>

<P>Have you ever done this:

<P>
<PRE>
This is &lt;B Very Important&lt;/B&gt;!
</PRE>

<P>These kinds of errors can be eliminated by replacing HTML
constructs, even simple ones, by FunnelWeb macros:

<P>
<PRE>
@$@&lt;B@&gt;@(@1@)@M@{&lt;B&gt;@1&lt;/B&gt;@}
...
This is @&lt;B@&gt;@(Very Important@)!
</PRE>

<P>While this is a bit messier, it eliminates the chance of an
error because if you get the syntax wrong, FunnelWeb will generate
an error at "compile time", which is a lot better than receiving
email from some random web visitor. It's true that the same level
of checking can be obtained by running an HTML syntax checker
over your web. However, if you're using FunnelWeb for all its
other benefits, you might as well use this aspect too.

<P><BR><FONT SIZE="4"><STRONG>File Names In Hyperlinks</STRONG></FONT><BR>

<P>Another source of error in webs is bad internal links.
This can occur when you rename a file and forget to "fix up"
all the links to it, and when you make a typing error when
typing in a filename in a hyperlink.

<P>You can use FunnelWeb to eliminate both of these kinds
of error, by defining a macro for each output file. This is
easier to do than explain:

<P>
<PRE>
@!************************************************

@$@&lt;Begin page@&gt;@(@1@)@M@{
&lt;HTML&gt;
&lt;HEAD&gt;
&lt;TITLE&gt;@1&lt;/TITLE&gt;
&lt;/HEAD&gt;
&lt;BODY BGCOLOR=#FFFFFF TEXT=#000033&gt;
@}

@$@&lt;End page@&gt;@M@{
&lt;/BODY&gt;
&lt;/HTML&gt;
@}

@!************************************************

@O@&lt;index.html@&gt;@{
@&lt;Begin page@&gt;@(Dave's Home Page@)

&lt;P&gt;Welcome to my home page. Check out my
&lt;A HREF="@&lt;Links FILE@&gt;"&gt;links page&lt;/A&gt; and my
&lt;A HREF="@&lt;Hobbies FILE@&gt;"&gt;hobbies page&lt;/A&gt;.

@&lt;End page@&gt;
@}

@!************************************************

@$@&lt;Links FILE@&gt;@M@{links.html@}
@O@&lt;links.html@&gt;@{
@&lt;Begin page@&gt;@(Dave's Links@)

&lt;P&gt;Here are my links:

&lt;P&gt;
&lt;A HREF="http://www.yahoo.com/"&gt;Yahoo&lt;/A&gt;&lt;BR&gt;
&lt;A HREF="http://www.dilbert.com/"&gt;Dilbert&lt;/A&gt;&lt;BR&gt;

@&lt;End page@&gt;
@}

@!************************************************

@$@&lt;Hobbies FILE@&gt;@M@{hobbies.html@}
@O@&lt;hobbies.html@&gt;@{
@&lt;Begin page@&gt;@(Dave's Hobbies@)

&lt;P&gt;This page is under construction!

@&lt;End page@&gt;
@}

@!************************************************
</PRE>

<P>Again, this technique introduces a little messiness, but
the benefits it brings are significant. Once you have deployed
this technique throughout your web source file, you will then
be free to change the names of any of your files without ever
having to worry about fixing up any links - they will all be
fixed automatically! Furthermore, if you delete an output
file from your FunnelWeb source file, FunnelWeb will alert
you to any "dangling links" because the references to the
deleted page take the form of calls to a macro that is no
longer defined! Of course, this only works if you don't mark
your filename macros with <SAMP>@Z</SAMP>.

<P>The only thing you have to get right is to ensure that
the filename of the output macro is the same as the value
of the corresponding naming macro. This isn't too hard to
do because they are always on adjacent lines.

<P>The benefit of eliminating all bad links from one's
web is a benefit that can be obtained by running an external
web analysis tool over your web. However, by using FunnelWeb
file naming macros, you can be SURE that the web can never
be generated with a bad link, whereas the web analysis tool
only works if you remember to run it!

<P><BR><FONT SIZE="4"><STRONG>People's Names</STRONG></FONT><BR>

<P>Sometimes you might have to create a web that contains lots
of long names that are hard to remember or spell. FunnelWeb
can help here by eliminating the chance of error. Just define
each name as macro and always call the macro when using the
name. The benefit of doing this is that FunnelWeb will always
detect a spelling error because if you make a spelling error
in the macro name, FunnelWeb will generate a "macro not defined"
error.

<P>
<PRE>
@$@&lt;Marvin Hylrzbvwryvitz@&gt;@M@{Marvin Hylrzbvwryvitz@}
</PRE>

<P>If you want to, you could used a shortened form. For example:

<P>
<PRE>
@$@&lt;Marvin@&gt;@M@{Marvin Hylrzbvwryvitz@}
</PRE>

<P><BR><FONT SIZE="4"><STRONG>CGI Form Fields</STRONG></FONT><BR>

<P>One of the organizational challenges of implementing
CGI form processing is getting all the field names right.
Because (normally) the form is in one file, and the CGI
script that processes it is in another file, it's very
easy to accidentally use different names for the same
field. For example, you might use <SAMP>email_adr</SAMP> in
one and <SAMP>email-adr</SAMP> in the other.

<P>FunnelWeb can be used to completely eliminate this
problem as follows:

<P>
<OL>

<LI> Put both the HTML file containing the form and the
CGI file that processes it within the <SAMP>.fw</SAMP> file
that embodies your web.

<BR><BR>

<LI> Define a macro for the name of each field and use
the macro in both the form and the CGI script.

</OL>

<P>Here's an example:

<P>
<PRE>
@!************************************************

@$@&lt;Email FIELD@&gt;@M@{email_adr@}

@!************************************************

@O@&lt;order.html@&gt;@{
@&lt;Begin page@&gt;@(Order Form@)

&lt;P&gt;
&lt;FORM ...&gt;
&lt;INPUT TYPE="text" NAME="@&lt;Email FIELD@&gt;"&gt;
...
&lt;/FORM&gt;

@&lt;End page@&gt;
@}

@!************************************************

@O@&lt;order.cgi@&gt;@{@-
@&lt;Begin CGI page@&gt;
...
$v = $form{'@&lt;Email FIELD@&gt;'};
@&lt;End CGI page@&gt;
@}

@!************************************************
</PRE>

<P>This technique more or less completely eliminates
mismatch errors in form field names, for if any such error
is made, FunnelWeb will generate a "macro not defined"
error. All you have to do to benefit from this technique
is get into the habit of using it.

<P><BR><FONT SIZE="4"><STRONG>When Global Replace Fails</STRONG></FONT><BR>

<P>Many people who write HTML directly use nerve wracking
multi-file global replaces to perform the kind of web
parameterization that FunnelWeb makes so easy.
Unfortunately, these global replacements can go badly wrong
because the target text may be used in many different
contexts. In some cases, this approach fails completely.

<P>For example, suppose that you have to create a hundred
page web that has to be laced with two email addresses: a
"business" email address and a "personal" email address. No
problem so far. However, suppose that you haven't yet chosen
a business domain name and, as a result,  at the current
time, the two email addresses are the same! If this were the
case, you would have to put your address throughout all the
pages and would LOSE the information of which were supposed
to be business addresses and which were supposed to be
personal ones.

<P>FunnelWeb solves this problem (and others like it)
completely by allowing you to define two macros one for each
context. For example:

<P>
<PRE>
@$@&lt;Business EMAIL@&gt;@M@{dave@@someisp.com.au@}
@$@&lt;Personal EMAIL@&gt;@M@{dave@@someisp.com.au@}
</PRE>

<P>These macros can then be used as appropriate. Later,
when the domain name comes through and the business address
changes, all that needs to be changed is a single definition:

<P>
<PRE>
@$@&lt;Business EMAIL@&gt;@M@{dave@@megacorp.com.au@}
@$@&lt;Personal EMAIL@&gt;@M@{dave@@someisp.com.au@}
</PRE>

<P>There is no need to perform a multi-file global replace
and evaluate the context of the use of each email address,
as the information was not lost when the web was originally
created, because of the two macros.

<P>This example is just one of many similar situations that
arise. By locating all the pages of your web in a single file
and allowing you to define macros for different purposes,
you can eliminate much of the time and danger of global
replacements.


<P>
<TABLE WIDTH="100%">
<TR>
<TD ALIGN="left"   VALIGN="bottom"><A HREF="web_messy.html"><IMG SRC="binary/fw_left.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Prev"></A></TD>
<TD ALIGN="center" VALIGN="bottom"><A HREF="web.html"><IMG SRC="binary/fw_up.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Up"></A></TD>
<TD ALIGN="right"  VALIGN="bottom"><A HREF="web_style.html"><IMG SRC="binary/fw_right.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Next"></A></TD>
</TR>
</TABLE>



<HR>
<FONT SIZE="2">
<A HREF="mailto:webmaster@ross.net">Webmaster</A>&nbsp;&nbsp;&nbsp;
<A HREF="copyright.html">Copyright &copy; Ross N. Williams 1992,1999. All rights reserved.</A><BR>
</FONT>

</FONT>
</TD>
</TR>
</TABLE>


</BODY>

<!-- *********************************************************************** -->
<!--      End Of A FunnelWeb Manual Web Page (www.ross.net/funnelweb/)       -->
<!-- *********************************************************************** -->

</HTML>