Adding the XML Button


OK, so you've uploaded your RSS file onto your Web server. How do you let your eager public subscribe to your new feed? Answer: Display an RSS, XML, or Atom button on your Web page. You can download those buttons from the Internet (Figure 3.34). You can even capture RSS buttons from other RSS feeds; just make sure you have permission first.

Figure 3.34. You can download XML, RSS, or Atom buttons from the Internet.


Tip

You can also find RSS buttons using an image search on Google. Just click the Image link above the search box instead of selecting the default Web link.


Tip

Want to create your own XML/RSS button? Take a look at www.feedforall.com/public/rss-graphic-tool.htm.


How do you actually display an XML button and make it active in a Web page? First, put together the Web page in which you want to display your XML button, something like this:

    <html>      <head>        <title>Subscribe to my feed</title>      </head>      <body>        <h1>Subscribe to my feed</h1>        Want to hear more of Steve's news? Subscribe to my feed!        <br>            .            .            .      </body>    </html> 


Then add the XML button. It's set up as a hyperlink to your XML file like this:

    <html>      <head>        <title>Subscribe to my feed</title>      </head>      <body>        <h1>Subscribe to my feed</h1>        Want to hear more of Steve's news? Subscribe to my feed!        <br>        <a href="http://www.rssmaniac.com/steve/news.xml">            .            .            .        </a>      </body>    </html> 


Next, add the image for the RSS button. Assuming the name of the RSS button's image file is rss.jpg and it's in the same directory as the Web page where you want to display that button, the code might look like the following (the border="0" below removes the hyperlink border that would appear around the buttonXML buttons don't usually show that border).

If your button's image is in another directory, make sure you add the right path to the image file's nameyou can even use a URL that points to the image file on another server.

    <html>      <head>        <title>Subscribe to my feed</title>      </head>      <body>        <h1>Subscribe to my feed</h1>        Want to hear more of Steve's news? Subscribe to my feed!        <br>        <a href="http://www.rssmaniac.com/steve/news.xml">          <img src="/books/1/255/1/html/2/rss.jpg" border="0">        </a>      </body>    </html> 


This code gives you the Web page in which the XML button appears (see Figure 3.34). Very nicenow you've made your feed publicly available.

There's another way to add your RSS feed to a Web page. You can use the autodetect method, and browsers (like Firefox) or RSS readers that support this feature display an icon in the status bar (or use another technique) that allow users to automatically subscribe to your feed.

To set up autodetect, add a <link> element to a Web page's <head> section. For example, here's how you can set up autodetect to a news feed at http://rssmaniac.com/steve/news.xml using a <link> element:

    <html>      <head>      <title>Subscribe to my feed</title>      <link rel="alternate" type="application/rss+xml" title="RSS 2.0"        href="http://rssmaniac.com/steve/news.xml" />      </head>      <body>        <h1>Subscribe to my feed</h1>        Want to hear more of Steve's news? Subscribe to my feed!        <br>        <a href="http://www.rssmaniac.com/steve/news.xml">           <img src="/books/1/255/1/html/2/rss.jpg" border="0">        </a>      </body>    </html> 




Secrets of RSS
Secrets of RSS
ISBN: 0321426223
EAN: 2147483647
Year: 2004
Pages: 110

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net