Creating a CDF File

Here's just about the simplest possible CDF file for planets.html, which I'll call planets.cdf:

<?xml version="1.0"?>
<CHANNEL HREF="http://www.starpowder.com/planets.html">
</CHANNEL>

This example just creates the most basic possible channel, based on a single Web page. The user has to click the channel to be able to download any content because we haven't set up a schedule for automatic updating yet.

As you can see, this document is a very simple one—all you need is the XML declaration and a <CHANNEL> element. The <CHANNEL> element uses a single attribute, HREF, to specify the URI of a page that will become the channel's main page, displayed in Internet Explorer when the user clicks the channel (refer to Figure 18.3).

On the other hand, most channels aren't made up of a single page, but rather several pages. You add those pages with the <ITEM> element.

Adding <ITEM> Children

To add child pages to a channel, you use the <ITEM> element. For example, say that I want to keep planets.html as the main page for the channel, but I want to add child pages for various planets: mercury.html, venus.html, earth.html, and venus.html. I can do that with the <ITEM> element, setting that element's HREF attribute to the URI of each child page in turn:

<?xml version="1.0"?>
<CHANNEL HREF="http://www.starpowder.com/planets.html">
    <ITEM HREF="http://www.starpowder.com/mercury.html">
    </ITEM>
    <ITEM HREF="http://www.starpowder.com/venus.html">
    </ITEM>
    <ITEM HREF="http://www.starpowder.com/earth.html">
    </ITEM>
    <ITEM HREF="http://www.starpowder.com/venus.html">
    </ITEM>
</CHANNEL>

Now we have five pages in this channel. So how do you install this channel in Internet Explorer?

Connecting a CDF File to a Web Page

To subscribe to a channel, the user only needs to open the channel's CDF file. You usually link to a CDF file and let the user subscribe to your channel simply by clicking the link. For example, here's how I might add such a hyperlink to planets.html—note that the target of the hyperlink is simply the CDF file, planets.cdf:

<HTML>
    <HEAD>
        <TITLE>
            The Planets
        </TITLE>
    </HEAD>

    <BODY>
        <CENTER>
            <H1>
                Welcome to the Planets!
            </H1>
            <BR>
            This is where you'll find all things planetary.
            <BR>
            <A HREF="planets.cdf">Subscribe to this page!</A>
        </CENTER>
    </BODY>
</HTML>

Now when the user clicks the link, Internet Explorer informs the user that a new page, corresponding to this channel, will be added to the Favorites list, as you see in Figure 18.5.

Figure 18.5. Subscribing to a channel.


So far, so good—we've created a channel with a main page and four children. Note that the name of the channel in Figure 18.5 is simply the name of the page because we haven't given the channel a title. I'll do that next.

Describing a Channel

You can describe a channel to a user in three ways—with titles, abstracts, and logos. I'll take a look at those possibilities in order.

Channel Titles

If you give a channel a title, that title will appear in the Favorites bar. You can also give a title to each child page in the channel. All this happens with the <TITLE> element. For example, here's how I add a title to the channel and all the child pages in planets.cdf:

<?xml version="1.0"?>
<CHANNEL HREF="http://www.starpowder.com/planets.html">
    <TITLE>Planets</TITLE>
    <ITEM HREF="http://www.starpowder.com/mercury.html">
        <TITLE>All about Mercury</TITLE>
    </ITEM>
    <ITEM HREF="http://www.starpowder.com/venus.html">
        <TITLE>All about Venus</TITLE>
    </ITEM>
    <ITEM HREF="http://www.starpowder.com/earth.html">
        <TITLE>All about Earth</TITLE>
    </ITEM>
    <ITEM HREF="http://www.starpowder.com/mars.html">
        <TITLE>All about Mars</TITLE>
    </ITEM>
</CHANNEL>

You can see the results in Figure 18.6—as you can see, all the pages in the channel now have easily readable titles. If the user is interested in updating any of these pages, he or she must only click them.

Figure 18.6. Channels with titles.


Besides using titles, you can also add abstracts to the pages in a channel.

Channel Abstracts

Channel titles are fine, but necessarily brief. A channel abstract can hold more information about the channel, but its text must also be fairly brief because that text appears in a ToolTip (one of those small yellow boxes with explanatory text that appear near the mouse pointer) for the associated channel page.

You can create an abstract for a page in a channel with the <ABSTRACT> element. For example, I can add abstracts to the various pages in the Planets channel like this:

<?xml version="1.0"?>
<CHANNEL HREF="http://www.starpowder.com/planets.html">
    <TITLE>Planets</TITLE>
    <ITEM HREF="http://www.starpowder.com/mercury.html">
        <TITLE>All about Mercury</TITLE>
        <ABSTRACT>
            All planetary information for
            Mercury, including orbital specifications.
        </ABSTRACT>
    </ITEM>
    <ITEM HREF="http://www.starpowder.com/venus.html">
        <TITLE>All about Venus</TITLE>
        <ABSTRACT>
            All planetary information for
            Venus, including orbital specifications.
        </ABSTRACT>
    </ITEM>
    <ITEM HREF="http://www.starpowder.com/earth.html">
        <TITLE>All about Earth</TITLE>
        <ABSTRACT>
            All planetary information for
            Earth, including orbital specifications.
        </ABSTRACT>
    </ITEM>
    <ITEM HREF="http://www.starpowder.com/mars.html">
        <TITLE>All about Mars</TITLE>
        <ABSTRACT>
            All planetary information for
            Mars, including orbital specifications.
        </ABSTRACT>
    </ITEM>
</CHANNEL>

You can see the results in Figure 18.7, where you see an abstract displayed as a ToolTip.

Figure 18.7. Channels with abstracts.


Another way to describe a channel is with logos. We'll look at these next.

Channel Logos

You can add logos—icons and images—to channels, using the <LOGO> element to the <CHANNEL> or <ITEM> elements. You specify what type of logo you're creating with the STYLE attribute, which takes these values:

ValueDescription
ICON16 × 16 pixel icon. This image appears in the Favorites bar hierarchy.
IMAGE80 × 32 pixel image. In Active Desktop installations, this logo is placed in the desktop Channel bar, which provides quick access to the channel's main page.
IMAGE-WIDE194 × 32 pixel image. Wide logos appear in the browser's Favorites bar to provide a link to the main channel page. When clicked, this image expands or contracts the channel's child list if the channel has children.

Here's an example where I'm adding logos to the Planets channel:

<?xml version="1.0"?>
<CHANNEL HREF="http://www.starpowder.com/planets.html">
    <TITLE>Planets</TITLE>

    <LOGO HREF="http://www.starpowder.com/icon.gif" STYLE="ICON"/>
    <LOGO HREF="http://www.starpowder.com/image.gif" STYLE="IMAGE"/>
    <LOGO HREF="http://www.starpowder.com/image-wide.gif" STYLE="IMAGE-WIDE"/>

    <ITEM HREF="http://www.starpowder.com/mercury.html">
        <TITLE>All about Mercury</TITLE>
        <ABSTRACT>
            All planetary information for
            Mercury, including orbital specifications.
        </ABSTRACT>
    </ITEM>

    <ITEM HREF="http://www.starpowder.com/venus.html">
        <TITLE>All about Venus</TITLE>
        <ABSTRACT>
            All planetary information for
            Venus, including orbital specifications.
        </ABSTRACT>
    </ITEM>

    <ITEM HREF="http://www.starpowder.com/earth.html">
        <TITLE>All about Earth</TITLE>
        <ABSTRACT>
            All planetary information for
            Earth, including orbital specifications.
        </ABSTRACT>
    </ITEM>
  
  <ITEM HREF="http://www.starpowder.com/mars.html">
        <TITLE>All about Mars</TITLE>
        <ABSTRACT>
            All planetary information for
            Mars, including orbital specifications.
        </ABSTRACT>
    </ITEM>
</CHANNEL>

The icon image for the planets channel—a red circle—has replaced the default icon for the channel (see Figure 18.8).

Figure 18.8. Replacing the Channel icon.


Scheduling Automatic Updates

You can set up a channel so that the browser downloads channel content automatically if it has been updated. (The browser relies on the Last-Modified item in the HTTP header of a Web page to check when the page was last modified.) I advise you to use this feature with caution—few things annoy users more than when software such as Internet Explorer seems to take over by itself and do mysterious things.

You use a <SCHEDULE> element to create a channel schedule. This element has three attributes:

AttributeDescription
STARTDATEIndicates when the schedule is to start.
STOPDATEIndicates when schedule is to end (if you don't use this attribute, the schedule never expires).
TIMEZONEGives the difference in hours between the server's time zone and Greenwich Mean Time. For example, EST is -0500, CST is -0600, MST is -0700, PST -0800, and Alaska and Hawaii are -1000.

The <SCHEDULE> element can itself have three child elements:

ElementDescription
<INTERVALTIME>Is required. Indicates how often to check for updates. Has DAY (1–7), HOUR (0–23), and MIN (0–59) attributes.
<EARLIESTTIME>Indicates the earliest time to update. Has DAY (1–7), HOUR (0–23), and TIMEZONE (default is the user's timezone) attributes.
<LATESTTIME>Indicates the latest time to update. Has DAY (1–7), HOUR (0–23), and TIMEZONE (default is the user's timezone) attributes.

For example, say that I wanted to have Internet Explorer check once every five days if a channel's content has changed and so needs to be downloaded automatically, and I wanted to download new content only between 3 and 5 a.m. That looks like this:

<?xml version="1.0"?>
<CHANNEL HREF="http://www.starpowder.com/planets.html">
    <TITLE>Planets</TITLE>

    <LOGO HREF="http://www.starpowder.com/icon.gif" STYLE="ICON"/>
    <LOGO HREF="http://www.starpowder.com/image.gif" STYLE="IMAGE"/>
    <LOGO HREF="http://www.starpowder.com/image-wide.gif" 
STYLE="IMAGE-WIDE"/>

    <SCHEDULE TIMEZONE="-0800">
        <INTERVALTIME DAY="5"/>
        <EARLIESTTIME HOUR="3" TIMEZONE="-0800"/>
        <LATESTTIME HOUR="5" TIMEZONE="-0800"/>
    </SCHEDULE>

    <ITEM HREF="http://www.starpowder.com/mercury.html">
        <TITLE>All about Mercury</TITLE>
        <ABSTRACT>
            All planetary information for
            Mercury, including orbital specifications.
        </ABSTRACT>
    </ITEM>
    
<ITEM HREF="http://www.starpowder.com/venus.html">
        <TITLE>All about Venus</TITLE>
        <ABSTRACT>
            All planetary information for
            Venus, including orbital specifications.
        </ABSTRACT>
    </ITEM>

    <ITEM HREF="http://www.starpowder.com/earth.html">
        <TITLE>All about Earth</TITLE>
        <ABSTRACT>
            All planetary information for
            Earth, including orbital specifications.
        </ABSTRACT>
    </ITEM>

    <ITEM HREF="http://www.starpowder.com/mars.html">
        <TITLE>All about Mars</TITLE>
        <ABSTRACT>
            All planetary information for
            Mars, including orbital specifications.
        </ABSTRACT>
    </ITEM>

</CHANNEL>

Again, you should be very cautious when setting up automatic updates—they can be confusing to the user, who may get very annoyed and have no idea how to cancel such updating.

Turning Off Precaching

When channel content is downloaded, it is cached automatically so that the user may view it later. However, if you want to turn off precaching, you can set the <CHANNEL> element's PRECACHE attribute to "NO":

<CHANNEL PRECACHE="NO" HREF=...
        .
        .
        .
</CHANNEL>

If you do turn off precaching, nothing will be downloaded automatically from the channel.

Downloading Pages in a Hierarchy

You can also make Internet Explorer download a whole Web site, not just those pages listed in <ITEM> elements, although this can be very wasteful of bandwidth. To do this, you use the <CHANNEL> element's LEVEL attribute, which indicates how many levels deep in a page hierarchy you want the browser to fetch pages from (the hierarchy is constructed by linking pages with hyperlinks).

You can set LEVEL to values from 0 to 3, as here, where I set it to 2:

<?xml version="1.0"?>
<CHANNEL LEVEL="2"
    HREF="http://www.starpowder.com/planets.html">
    <TITLE>Planets</TITLE>

    <LOGO HREF="http://www.starpowder.com/icon.gif" STYLE="ICON"/>
    <LOGO HREF="http://www.starpowder.com/image.gif" STYLE="IMAGE"/>
    <LOGO HREF="http://www.starpowder.com/image-wide.gif" STYLE="IMAGE-WIDE"/>

    <SCHEDULE TIMEZONE="-0800">
        <INTERVALTIME DAY="5"/>
        <EARLIESTTIME HOUR="3" TIMEZONE="-0800"/>
        <LATESTTIME HOUR="5" TIMEZONE="-0800"/>
    </SCHEDULE>

    <ITEM HREF="http://www.starpowder.com/mercury.html">
        <TITLE>All about Mercury</TITLE>
        <ABSTRACT>
            All planetary information for
            Mercury, including orbital specifications.
        </ABSTRACT>
    </ITEM>
    .
    .
    .
</CHANNEL>

In this case, Internet Explorer will "Web crawl" two levels deep and retrieve all the documents when the main channel page changes. Note, however, that this is almost always wasteful, unless you really change your whole Web site when the main channel page changes.

Logging User Access

Using the <LOG> and <LOGTARGET> elements, which are children of the <CHANNEL> element, you can track which downloaded channel pages a user looks at offline. This can be useful if you have advertisements on those pages and need to know which pages were actually viewed. From the user's point of view, of course, it can also feel like another invasion of privacy.

To set up logging, you use the <LOG> element like this; you need the VALUE attribute (it's required), and the only valid value currently is "document:view":

<LOG VALUE="document:view"/>

The <LOGTARGET> element specifies where to send logging information. This information is sent in a way that can be handled by CGI scripts. This element has these attributes:

AttributeDescription
HREFSpecifies the URI to send logging information to.
METHODSpecifies the method used to send logging information; can be POST or PUT.
SCOPESpecifies what types of page viewing to count. It can be ALL, ONLINE, or OFFLINE.

The <LOGTARGET> element also has two possible child elements:

AttributeDescription
<PURGETIME>Specifies the number of hours for which logging information is valid. Set the HOUR attribute to a number of hours.
<HTTP-EQUIV>Allows you to set key value pairs in the HTTP MIME header to send to the logging target.

For example, here's how I could enable offline logging in planets.cdf, sending updates to a CGI script named log.cgi:

<?xml version="1.0"?>
<CHANNEL HREF="http://www.starpowder.com/planets.html">
    <TITLE>Planets</TITLE>

    <LOGO HREF="http://www.starpowder.com/icon.gif" STYLE="ICON"/>
    <LOGO HREF="http://www.starpowder.com/image.gif" STYLE="IMAGE"/>
    <LOGO HREF="http://www.starpowder.com/image-wide.gif" STYLE="IMAGE-WIDE"/>

    <SCHEDULE TIMEZONE="-0800">
        <INTERVALTIME DAY="5"/>
        <EARLIESTTIME HOUR="3" TIMEZONE="-0800"/>
        <LATESTTIME HOUR="5" TIMEZONE="-0800"/>
    </SCHEDULE>

    <LOG VALUE="document:view"/>

    <LOGTARGET METHOD="POST" SCOPE="OFFLINE"
        HREF="http://www.starpowder.com/cgi-bin/log.cgi">
        <PURGETIME HOUR="24"/>
        <HTTP-EQUIV NAME="ENCODING-TYPE" VALUE="text"/>
    </LOGTARGET>
    <ITEM HREF="http://www.starpowder.com/mercury.html">
        <TITLE>All about Mercury</TITLE>
        <ABSTRACT>
            All planetary information for
            Mercury, including orbital specifications.
        </ABSTRACT>
    </ITEM>
    .
    .
    .
</CHANNEL>
					

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.98.111