The View
The view component for the application is a Web page. As part of the View, I'll use CSS to handle the data formatting and HTML as a structured data container Open your favorite text editor and create the stylesheet:
Save the file as newsfeed.css in a clean directory.
The Controller layer generates most of the HTML dynamically, but you still need to create an HTML shell for the application to fill with data. Create the file newsfeed.htm by entering the following code:
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.
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.