HTML The Definitive Guide (140 page)

Read HTML The Definitive Guide Online

Authors: Chuck Musciano Bill Kennedy

BOOK: HTML The Definitive Guide
9.23Mb size Format: txt, pdf, ePub

echo "Content-type: text/html"

echo ""

echo ""

echo ""

echo "Processes On This Server"

echo ""

echo ""

echo " Processes On This Server"

echo "Date:"

date

echo "

"

echo "

"

ps -el

echo "

"

echo ""

echo ""

echo "--NEXT"

sleep 5

done

In a nutshell, this example script updates a list of the processes running on the server machine every five seconds. The update continues until the browser breaks the connection by moving on to another document, or after completing 60 cycles (about five minutes).

We offer this shell script example to illustrate the basic logic behind any server-push document generator. In reality, you should create your server-side applications using a more conventional programming language like Perl or C. The applications run more efficiently and can better detect when the client has severed the connection to the server.

14.2 Client-Pull Documents

15. Tips, Tricks, and Hacks

Chapter 15

15. Tips, Tricks, and Hacks

Contents:

Top of the Tips

Trivial or Abusive?

Custom Bullets

Tricks with Tables

Transparent Images

Tricks with Windows and Frames

We've sprinkled a number of tips, tricks, and hacks throughout this book, along with style guidelines, examples, and instructions. So why have a special chapter on tips, tricks, and hacks of HTML?

Because it's where many readers will leaf to when they pick up this book for the first time. HTML is the language, albeit constrained, that makes the World Wide Web on the Internet the exciting place that it is. And interested readers want to know, "How do I do the cool stuff?"

15.1 Top of the Tips

The most important tip for even veteran HTML authors is to surf for yourself. We can show and explain a few neat tricks to get you started, but there are thousands of HTML authors out there combining and recombining HTML tags and juggling content to create compelling and useful documents.

Get a bona fide Internet account; get copies of Netscape, Internet Explorer, and whatever other browser you feel comfortable operating; get connected; and get cruising. Collect web site URLs from friends, business associates, and the traditional media. Even local TV and radio stations have taken to announcing some of their sponsors' web site URLs. And consult the many different Internet web directories like Yahoo and AltaVista for new and up-to-date addresses for the web sites that suit your lifestyle or business niche.

Examine (don't steal) their pages for eye-catching and effective pages and use them to guide your own creations. Capture and examine the source HTML documents for the juicy bits. Get a feel of the more effective web collections. How are their documents organized? How large is each document? And so on.

We all learn from experience, so go get it.

15.1.1 Design for Your Audience

We continuously argue throughout the book that, with HTML documents, content matters most, not look. That doesn't mean that presentation doesn't matter.

Effective HTML documents match your target audience's expectations, giving them a familiar environment in which to explore and gather information. Serious academicians expect a treatise on the physiology of the kumquat to appear journal-like: long on meaningful words, figures, and diagrams and short on frivolous trappings like cute bullets and font abuse. Don't insult the reader's eye, except when exercising artistic license to jar or attack your reader's sensibilities.

By anticipating your audience and by designing your documents to appeal to their tastes, you also
subtly deflect unwanted surfers from your pages. Undesirables, such as penniless college students[1]

surfing your commercial site, may hog your server's resources and prevent the buying audience you desire from ready access to your pages.

[1] Not that there's anything wrong with that. We both started out as penniless college students and years later, wound up writing for O'Reilly & Associates.

For example, you can use subtle colors and muted text transitions between sections for a classical art museum's collection to mimic the hushed environment of a real classical art museum. The typical rock-'n'-roll crazed web surfer maniac probably won't spend more than a glance at your site, but the millionaire arts patron might.

Also, use effective layout to gently guide your readers' eyes to areas of interest in your documents. Do that by adhering to the basic rules of document layout and design, such as placing figures and diagrams nearby - if not inline - with their content reference. Nothing's worse than having to scroll up and down the browser window in a desperate search for a picture that can explain everything.

We won't lie and suggest that we're design experts. We aren't, but they're not hard to find. So, another tip for the serious web page author: seek professional help. The best situation is to have design experience yourself. Next best is to have a pro looking over your shoulder, or at least somewhere within earshot.

Make a trip to your local library and do some reading on your own, too. Even better yet, browse the various online HTML guides. Check out Designing for the Web (O'Reilly & Associates). Your
readers will be glad you did. [Tools for the HTML Designer, 1.6]

15.1.2 Boilerplate HTML Documents

The next best tip we can give you is to reuse your documents. Don't start from scratch each time.

Rather, develop a consistent framework, even to the point of a content outline into which you add the detail and character for each page. You might even endevour to create style sheets, so that the look and feel of your documents remain consistent.

Here's our contribution to help start your boilerplate HTML document collection. The following source contains what the HTML standard currently tells us is the minimum content that should appear in every HTML document (regardless of what the browsers might let you get away with) and then some added for document clarity. Use it as a skeleton for your own HTML documents:

Other books

Her Only Hero by Marta Perry
Late Stories by Stephen Dixon
Desire Me Now by Tiffany Clare
Cold Fusion by Olivia Rigal
Hearts Racing by Hodgson, Jim
Bred By The Vampire by Rose, Emma
Fatal Care by Leonard Goldberg
Desire Wears Diamonds by Renee Bernard
Wrack and Rune by Charlotte MacLeod