Integrating News Feeds (cont'd)

Where Are The News Feeds?
A few companies offer free news feeds that you can use. I've chosen to use moreover.com's free JavaScript news feeds for this solution. You can view a list of all the available news feeds at moreover.com here. The feeds are free only for not-for-profit Web sites. For profitable sites, moreover.comoffers a pay service—read the terms and conditions at their Web site for more details to determine which version is right for you.

Other companies such as Backwash.com and Magportal.com offer free JavaScript news feeds. Switching news feed providers usually results in slight modifications to your code. You can avoid most of these problems by using the Model View Controller (MVC) design pattern to implement the newsfeed. The sample code for this article implement an MVC architecture. The selected news feeds are the Model, the CSS and HTML comprise the View, and JavaScript acts as the Controller.

The Model View Controller Design Pattern
The Model View Controller (MVC) model is a design pattern that has gained favor in today's world of specialization. In essence, the MVC model breaks out any application into 3 logical tiers. The Model represents the data in the application. The View is the visible interface to the model—the user interface. The View can be a Visual Basic application, or a series of Java Server Pages, or static Web pages. In short, the View is the means by which the user interacts with the application. The Controller acts as the link between the Model and the View. It controls the flow of the application by brokering requests from the View to the Model.

There are some benefits to the MVC model, the most obvious being that developers can work on the piece that best suits their ability without worrying too much about the other tiers. Even if you generally work alone and develop each of the tiers, the benefits of modularization are real. Changes to a given tier minimizes the effect of those changes on the other tiers. In this solution, switching new feeds can be accomplished by editing just a few lines of code.




Previous: Introduction
 
Next: The Model


Introduction Where Are The News Feeds? The Model
The View The Controller Putting It All Together


Return to Get Help with dhtml Page

Return to Main Get Help Page
 





Problem: Users like news feeds, and they can increase traffic to your site, but the real trick is to implement them and avoid creating a maintenance nightmare. How can you implement a newsfeed generically, with reusable code?




Solution: Use the Model-View-Controller (MVC) architecture to minimizes the changes required to switch news feeds. This solution shows you how to switch news feeds by changing just a few lines of code.



Find Out More
Get the Code

Microsoft Windows Script Technologies

Essential JavaScript

Live Sample: Test the Newsfeed from Moreover.com

Moreover.com

Backwash.com

Magportal.com

TALK BACK
Do you use a newsfeed service now? Did you think you had to create complicated script or use controls to implement newsfeeds in your site? Do you like this article's approach to implementing a newsfeed? Join the discussions at Web.dhtml.general and Web.dhtml.scripting to get answers, make comments, or help others with their problems.
Talk Now


Sponsored Links