| 1 |
|
| 2 |
<HTML> |
| 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 |
<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 |
@$@<Dilbert@>@Z@M@{@- |
| 117 |
<A HREF="http://www.dilbert.com/">Dilbert</A>@} |
| 118 |
@$@<Yahoo@>@Z@M@{@- |
| 119 |
<A HREF="http://www.yahoo.com/">Yahoo</A>@} |
| 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@<links.html@>@{ |
| 131 |
@<Begin page@>@(Dave's Links@) |
| 132 |
|
| 133 |
<P>Check out @<Dilbert@> and @<Yahoo@>! |
| 134 |
|
| 135 |
@<End page@> |
| 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 |
<IMG SRC="bin/tick_red_12.gif" |
| 148 |
WIDTH="12" HEIGHT="12" |
| 149 |
HSPACE=4 VSPACE=0 |
| 150 |
ALT="*" BORDER="0"> |
| 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 |
@$@<Tick@>@M@{ |
| 159 |
<IMG SRC="bin/tick_red_12.gif" |
| 160 |
WIDTH="12" HEIGHT="12" |
| 161 |
HSPACE=4 VSPACE=0 |
| 162 |
ALT="*" BORDER="0">@} |
| 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 |
@<Tick@>Low cost.<BR> |
| 171 |
@<Tick@>Easy installation.<BR> |
| 172 |
@<Tick@>Available now!<BR> |
| 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 |
<SELECT NAME="Country"> |
| 185 |
<OPTION>United States |
| 186 |
<OPTION>Afghanistan |
| 187 |
<OPTION>Albania |
| 188 |
... |
| 189 |
<OPTION>Zambia |
| 190 |
<OPTION>Zimbabwe |
| 191 |
</SELECT> |
| 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 |
@$@<Country form field@>@M@( |
| 200 |
<SELECT NAME="Country"> |
| 201 |
<OPTION>United States |
| 202 |
<OPTION>Afghanistan |
| 203 |
<OPTION>Albania |
| 204 |
... |
| 205 |
<OPTION>Zambia |
| 206 |
<OPTION>Zimbabwe |
| 207 |
</SELECT> |
| 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 |
@<Country form field@> |
| 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 |
<TABLE WIDTH="100%"> |
| 227 |
<TR> |
| 228 |
<TD ALIGN="left" VALIGN="bottom">< |
| 229 |
A HREF="links.html"><IMG SRC="bin/left.gif"></A></TD> |
| 230 |
<TD ALIGN="center" VALIGN="bottom">< |
| 231 |
A HREF="home.html"><IMG SRC="bin/up.gif"></A></TD> |
| 232 |
<TD ALIGN="right" VALIGN="bottom">< |
| 233 |
A HREF="hobbies.html">< |
| 234 |
IMG SRC="bin/right.gif"></A></TD> |
| 235 |
</TR> |
| 236 |
</TABLE> |
| 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 |
@$@<Nav@>@(@3@)@Z@M@{ |
| 245 |
@<P@> |
| 246 |
<TABLE WIDTH="100%"> |
| 247 |
<TR> |
| 248 |
<TD ALIGN="left" VALIGN="bottom">< |
| 249 |
A HREF="@1"><IMG SRC="bin/left.gif"></A></TD> |
| 250 |
<TD ALIGN="center" VALIGN="bottom">< |
| 251 |
A HREF="@2"><IMG SRC="bin/up.gif"></A></TD> |
| 252 |
<TD ALIGN="right" VALIGN="bottom">< |
| 253 |
A HREF="@3"><IMG SRC="bin/right.gif"></A></TD> |
| 254 |
</TR> |
| 255 |
</TABLE> |
| 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 |
@<Nav@>@(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>@<End page@></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> |
| 286 |
<A HREF="copyright.html">Copyright © 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 |
|
| 299 |
|
| 300 |
|
| 301 |
</HTML> |