Ajax-The Confusing guide, part 2nd: Developing a blog reader based on Dojo

Source: Internet
Author: User
Tags html page require

The Atom protocol allows providers of network resources, such as news, community sites, and blogs, to chain their content through the Web. In a typical Atom application, content providers typically chain a file or a web feed and make it available on the web. The presentation of the feed is defined in the Atom syndication Format, which provides a summary of the newly added resources. The published feed can then be used by the Atom client software, such as the blog Reader, which uses the Atom Publishing Protocol to discover and present the newly added content.

This article will further enrich your knowledge by showing how to develop a blog reader based on Ajax and Atom (in this installment, you'll develop the reader's view and controller components). You will use the Dojo Toolbox to develop this application, which uses the Atom Publishing Protocol to communicate with the back-end Atom feed. In addition, you will use the Dojo storage package to hold feed subscription data.

Dojo-The Ajax Toolbox we've chosen

The blog Reader application is based on the Dojo Toolbox, and you might wonder why we chose Dojo over the other toolbox. The Book of Dojo (see Resources) gives a few of these reasons, but for the purposes of this exercise we only list the two simple reasons that drive us to use Dojo:

Vertical integration and Completion: Dojo provides the most comprehensive and integrated component library compared to other open source Ajax toolkits.

Black box reuse: The Dojo widget mechanism allows developers to build new applications from widgets without having to know their "insider". This makes the creation of complex Ajax applications simpler.

Vertical Integration and completion

Dojo has a layered architecture where each layer adds more advanced functionality:

The Dojo core layer contains basic Ajax features, Cross-browser compatibility, basic DOM processing, and so on in many toolkits, such as IO and DnD.

Above the Dojo core layer is the DIJIT layer, which provides a small part system and many widgets.

The final layer is DOJOX, which includes various extensions, such as offline storage and cross browser vector graphs.

Each layer of the Dojo architecture provides a comprehensive, integrated toolbox that meets most development requirements.

Black box Reuse-widgets

The Dojo widget is an Ajax-based UI component that can be reused with one line of HTML code. For example, listing 1 shows how an extensible title pane widget is instantiated in an HTML page:

Listing 1. Instantiating the Title pane widget in an HTML page

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">
  <script type="text/javascript" src="../../dojo/dojo.js"
      djConfig="parseOnLoad: true, isDebug: true"></script>
  <script language="JavaScript" type="text/javascript">
      dojo.require("dijit.TitlePane");
      dojo.require("dojo.parser");
  </script>
  <style type="text/css">
    @import "../../dojo/resources/dojo.css";
    @import "../themes/tundra/tundra.css";
  </style>
<body class="tundra">
  <div dojoType="dijit.TitlePane"
    title="This is the title" style="width: 300px;">
    And this is the content, clicking the title
    will expand/collapse me.
  </div>
</body>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.