Debian Codegraph @

tutorial/web_messy.html

raw symbols SCIP
1
2 <HTML>
3 <!--
4 ***********************************************************************
5 FUNNELWEB MANUAL WEB PAGE
6 =========================
7 Copyright (c) Ross N. Williams 1992,1999. All rights reserved.
8
9 Permission is granted to redistribute and use this manual in
10 any medium, with or without modification, provided that all
11 notices (including, without limitation, the copyright
12 notice, this permission notice, any record of modification,
13 and all legal notices) are preserved on all copies, that all
14 modifications are clearly marked, and that modified versions
15 are not represented as the original version unless all the
16 modifications since the manual's original release by Ross N.
17 Williams (www.ross.net) consist of translations or other
18 transformations that alter only the manual's form, not its
19 content. THIS MANUAL IS PROVIDED "AS IS" AND WITHOUT ANY
20 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
21 LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
22 FITNESS FOR A PARTICULAR PURPOSE. TO THE EXTENT PERMITTED BY
23 LAW THERE IS ABSOLUTELY NO WARRANTY.
24
25 ***********************************************************************
26 -->
27
28 <HEAD>
29 <TITLE>7.3 Replacing Messy HTML Constructs</TITLE>
30 <STYLE TYPE="text/css"> <!-- A {text-decoration: none} // --> </STYLE>
31 </HEAD>
32 <BODY BACKGROUND="binary/background.gif"
33 BGCOLOR="#FFFFFF"
34 TEXT="#000000"
35 VLINK="#660000"
36 LINK="#FF0000"
37 ALINK="#CC0000">
38
39 <TABLE WIDTH="490">
40 <TR>
41 <TD WIDTH="130" VALIGN="top">
42 <IMG SRC="binary/d_clear.gif" ALT="" WIDTH="130" HEIGHT="1"><BR>
43
44 <FONT SIZE="2">
45 <BR>
46
47 <A HREF="http://www.ross.net/"
48 TARGET="rosshome"
49 onClick="window.open('','rosshome','location,status,menubar,scrollbars,resizable',false).focus(); return true;"
50 >
51 <IMG SRC="binary/rossnet_logo.gif"
52 WIDTH="64" HEIGHT="32"
53 BORDER="0" ALT="RossNet"
54 HSPACE="0" VSPACE="1"></A><BR>
55 <BR>
56
57 <A HREF="../index.shtml"
58 TARGET="funnelweb"
59 onClick="window.open('','funnelweb','location,status,menubar,scrollbars,resizable',false).focus(); return true;"
60 >
61 <IMG SRC="binary/linklogo.gif"
62 WIDTH="64" HEIGHT="32"
63 BORDER="0" ALT="FunnelWeb"
64 HSPACE="0" VSPACE="1"></A><BR>
65 <BR>
66 <TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD BGCOLOR="#000000">
67 <A HREF="../reference/index.html"
68 TARGET="funnelwebreference"
69 onClick="window.open('','funnelwebreference','location,status,menubar,scrollbars,resizable',false).focus(); return true;"
70 ><FONT COLOR="#FFFFFF"><B>Reference</B></FONT></A><BR>
71 <BR>
72 <A HREF="../developer/index.html"
73 TARGET="funnelwebdeveloper"
74 onClick="window.open('','funnelwebdeveloper','location,status,menubar,scrollbars,resizable',false).focus(); return true;"
75 ><FONT COLOR="#FFFFFF"><B>Developer</B></FONT></A><BR>
76 <BR>
77 <A HREF="index.html"><FONT COLOR="#FFFFFF"><B>Tutorial</B></FONT></A><BR>
78 <A HREF="intro.html"><FONT COLOR="#FFFFFF">1 Introduction</FONT></A><BR>
79 <A HREF="macro.html"><FONT COLOR="#FFFFFF">2 Macros</FONT></A><BR>
80 <A HREF="type.html"><FONT COLOR="#FFFFFF">3 Typesetting</FONT></A><BR>
81 <A HREF="example.html"><FONT COLOR="#FFFFFF">4 Example</FONT></A><BR>
82 <A HREF="hints.html"><FONT COLOR="#FFFFFF">5 Hints</FONT></A><BR>
83 <A HREF="examples.html"><FONT COLOR="#FFFFFF">6 Examples</FONT></A><BR>
84 <A HREF="web.html"><FONT COLOR="#FFFFFF">7 Webmaking</FONT></A><BR>
85
86 <BR>
87 <A HREF="search.html"><FONT COLOR="#FFFFFF"><B>SEARCH</B></FONT></A><BR>
88 </FONT>
89 </TD></TR></TABLE>
90
91
92 </TD>
93 <TD WIDTH="360" VALIGN="top">
94 <FONT SIZE="3">
95
96
97 <A HREF="../reference/index.html"><IMG SRC="binary/title.gif"
98 WIDTH="302" HEIGHT="24"
99 BORDER="0" ALT="FunnelWeb Tutorial Manual"
100 HSPACE="0" VSPACE="0"></A>
101 <P><FONT SIZE="5">7.3 Replacing Messy HTML Constructs</FONT><BR>
102
103
104 <P>One of the greatest benefits of using FunnelWeb is its ability
105 to replace messy slabs of HTML with a simple macro call. This page
106 provides lots of examples of this.
107
108 <P><BR><FONT SIZE="4"><STRONG>Hyperlinks</STRONG></FONT><BR>
109
110 <P>Hyperlinks are messy and you can eliminate their messiness
111 from your FunnelWeb web source by defining a macro for each link
112 you want to use. For example:
113
114 <P>
115 <PRE>
116 @$@&lt;Dilbert@&gt;@Z@M@{@-
117 &lt;A HREF="http://www.dilbert.com/"&gt;Dilbert&lt;/A&gt;@}
118 @$@&lt;Yahoo@&gt;@Z@M@{@-
119 &lt;A HREF="http://www.yahoo.com/"&gt;Yahoo&lt;/A&gt;@}
120 </PRE>
121
122 <P>While the definitions themselves are certainly messy,
123 having made them, we are now free to refer to Dilbert and
124 Yahoo within our webs in a very clean manner indeed. For
125 example, the links page of the previous example now becomes
126 just:
127
128 <P>
129 <PRE>
130 @O@&lt;links.html@&gt;@{
131 @&lt;Begin page@&gt;@(Dave's Links@)
132
133 &lt;P&gt;Check out @&lt;Dilbert@&gt; and @&lt;Yahoo@&gt;!
134
135 @&lt;End page@&gt;
136 @}
137 </PRE>
138
139 <P><BR><FONT SIZE="4"><STRONG>Images</STRONG></FONT><BR>
140
141 <P>Suppose we want to include a small image of a checkmark
142 at various points without a web page. Here's the HTML that
143 has to be included at each point:
144
145 <P>
146 <PRE>
147 &lt;IMG SRC="bin/tick_red_12.gif"
148 WIDTH="12" HEIGHT="12"
149 HSPACE=4 VSPACE=0
150 ALT="*" BORDER="0"&gt;
151 </PRE>
152
153 <P>Yuk! To eliminate this mess in our FunnelWeb/HTML, we
154 can define a macro for a tick mark as follows:
155
156 <P>
157 <PRE>
158 @$@&lt;Tick@&gt;@M@{
159 &lt;IMG SRC="bin/tick_red_12.gif"
160 WIDTH="12" HEIGHT="12"
161 HSPACE=4 VSPACE=0
162 ALT="*" BORDER="0"&gt;@}
163 </PRE>
164
165 <P>Now, using tick marks without your text is easy.
166 Here's an example:
167
168 <P>
169 <PRE>
170 @&lt;Tick@&gt;Low cost.&lt;BR&gt;
171 @&lt;Tick@&gt;Easy installation.&lt;BR&gt;
172 @&lt;Tick@&gt;Available now!&lt;BR&gt;
173 </PRE>
174
175 <P><BR><FONT SIZE="4"><STRONG>Large Form Fields</STRONG></FONT><BR>
176
177 <P>Another example is where you have form fields
178 with lots of options. Here's an example of a commonly
179 occurring form field that goes on for a couple of
180 hundred lines!
181
182 <P>
183 <PRE>
184 &lt;SELECT NAME="Country"&gt;
185 &lt;OPTION&gt;United States
186 &lt;OPTION&gt;Afghanistan
187 &lt;OPTION&gt;Albania
188 ...
189 &lt;OPTION&gt;Zambia
190 &lt;OPTION&gt;Zimbabwe
191 &lt;/SELECT&gt;
192 </PRE>
193
194 <P>Using FunnelWeb, you can move all this to a single macro
195 definition as follows:
196
197 <P>
198 <PRE>
199 @$@&lt;Country form field@&gt;@M@(
200 &lt;SELECT NAME="Country"&gt;
201 &lt;OPTION&gt;United States
202 &lt;OPTION&gt;Afghanistan
203 &lt;OPTION&gt;Albania
204 ...
205 &lt;OPTION&gt;Zambia
206 &lt;OPTION&gt;Zimbabwe
207 &lt;/SELECT&gt;
208 </PRE>
209
210 <P>Now, whenever you want a country field in a form, you can
211 just write:
212
213 <P>
214 <PRE>
215 @&lt;Country form field@&gt;
216 </PRE>
217
218 <P><BR><FONT SIZE="4"><STRONG>Navigation Buttons</STRONG></FONT><BR>
219
220 <P>Sometimes the navigation constructs that appear
221 within pages can become rather messy. Here's an example
222 where we have three buttons at the bottom of each page.
223
224 <P>
225 <PRE>
226 &lt;TABLE WIDTH="100%"&gt;
227 &lt;TR&gt;
228 &lt;TD ALIGN="left" VALIGN="bottom"&gt;&lt;
229 A HREF="links.html"&gt;&lt;IMG SRC="bin/left.gif"&gt;&lt;/A&gt;&lt;/TD&gt;
230 &lt;TD ALIGN="center" VALIGN="bottom"&gt;&lt;
231 A HREF="home.html"&gt;&lt;IMG SRC="bin/up.gif"&gt;&lt;/A&gt;&lt;/TD&gt;
232 &lt;TD ALIGN="right" VALIGN="bottom"&gt;&lt;
233 A HREF="hobbies.html"&gt;&lt;
234 IMG SRC="bin/right.gif"&gt;&lt;/A&gt;&lt;/TD&gt;
235 &lt;/TR&gt;
236 &lt;/TABLE&gt;
237 </PRE>
238
239 <P>We can move all this to a single macro definition
240 that has three parameters, one for each target page.
241
242 <P>
243 <PRE>
244 @$@&lt;Nav@&gt;@(@3@)@Z@M@{
245 @&lt;P@&gt;
246 &lt;TABLE WIDTH="100%"&gt;
247 &lt;TR&gt;
248 &lt;TD ALIGN="left" VALIGN="bottom"&gt;&lt;
249 A HREF="@1"&gt;&lt;IMG SRC="bin/left.gif"&gt;&lt;/A&gt;&lt;/TD&gt;
250 &lt;TD ALIGN="center" VALIGN="bottom"&gt;&lt;
251 A HREF="@2"&gt;&lt;IMG SRC="bin/up.gif"&gt;&lt;/A&gt;&lt;/TD&gt;
252 &lt;TD ALIGN="right" VALIGN="bottom"&gt;&lt;
253 A HREF="@3"&gt;&lt;IMG SRC="bin/right.gif"&gt;&lt;/A&gt;&lt;/TD&gt;
254 &lt;/TR&gt;
255 &lt;/TABLE&gt;
256 @}
257 </PRE>
258
259 <P>Now, to add navigation buttons to a page,
260 we can just write (near the end of the page).
261
262 <P>
263 <PRE>
264 @&lt;Nav@&gt;@(links.html@,home.html@,hobbies.html@)
265 </PRE>
266
267 <P>If you wanted to, you could build the navigation
268 buttons into the <SAMP>@&lt;End page@&gt;</SAMP> macro
269 and set it up with three parameters instead.
270
271
272 <P>
273 <TABLE WIDTH="100%">
274 <TR>
275 <TD ALIGN="left" VALIGN="bottom"><A HREF="web_start.html"><IMG SRC="binary/fw_left.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Prev"></A></TD>
276 <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>
277 <TD ALIGN="right" VALIGN="bottom"><A HREF="web_errors.html"><IMG SRC="binary/fw_right.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Next"></A></TD>
278 </TR>
279 </TABLE>
280
281
282
283 <HR>
284 <FONT SIZE="2">
285 <A HREF="mailto:[email protected]">Webmaster</A>&nbsp;&nbsp;&nbsp;
286 <A HREF="copyright.html">Copyright &copy; Ross N. Williams 1992,1999. All rights reserved.</A><BR>
287 </FONT>
288
289 </FONT>
290 </TD>
291 </TR>
292 </TABLE>
293
294
295 </BODY>
296
297 <!-- *********************************************************************** -->
298 <!-- End Of A FunnelWeb Manual Web Page (www.ross.net/funnelweb/) -->
299 <!-- *********************************************************************** -->
300
301 </HTML>